text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>ECS160Android: game.CWallShape Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

ECS160Android

FortNitta Android platform team

Main Page

Related Pages

Classes

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

game

CWallShape

Public Member Functions |
Protected Attributes |
List of all members

game.CWallShape Class Reference

WallShape class.
 More...

Public Member Functions

 	CWallShape ()

 	WallShape constructor.

final void 	Randomize (int val)

 	Sets type and orientation of polyomino.  More...

void 	dispose ()

 	WallShape destructor.

final void 	Rotate ()

 	Changes polyomino orientation.

final void 	Draw (CGame game, CPlayer owner, Vector2 tile_position)

 	Draws wall shape for player.  More...

final Vector2 	GetBoundedPosition (CGame game, Vector2 tile_position)

 	Calculates the position bounded by the map.  More...

final boolean 	CanBePlaced (CGame game, CPlayer player, Vector2 tile_position)

 	Determines if wall shape can be placed by player.  More...

final int 	Height ()

 	Gets height of polyomino.

final int 	Width ()

 	Gets width of polyomino.

final boolean 	IsBlock (int x, int y)

 	Determines if part of the polyomino is contained at the position specified.  More...

final boolean 	Place (CGame game, CPlayer player, Vector2 tile_position)

 	Places wall shape into construction map.  More...

Protected Attributes

java.util.ArrayList< java.util.ArrayList< Boolean > > 	DLocations = new java.util.ArrayList<java.util.ArrayList<Boolean>>()

int 	DOrientation

Detailed Description

WallShape class.

Member Function Documentation

          final boolean game.CWallShape.CanBePlaced
          (
          CGame
          game,

          CPlayer
          player,

          Vector2
          tile_position

          )

Determines if wall shape can be placed by player.

Parameters

game	Game updating

player	Player placing shape

tile_position	Position to place at

Returns

true if can be placed, false otherwise

          final void game.CWallShape.Draw
          (
          CGame
          game,

          CPlayer
          owner,

          Vector2
          tile_position

          )

Draws wall shape for player.

Parameters

game	Game drawing

player	Player drawing for

tile_position	Position drawing at

          final Vector2 game.CWallShape.GetBoundedPosition
          (
          CGame
          game,

          Vector2
          tile_position

          )

Calculates the position bounded by the map.

Parameters

game	Game updating

tile_position	Position trying to plae

Returns

The position after bounding to the map

          final boolean game.CWallShape.IsBlock
          (
          int
          x,

          int
          y

          )

Determines if part of the polyomino is contained at the position specified.

Parameters

x	x position

y	y position

Returns

True if position contains part of polyomino, false if it does not

          final boolean game.CWallShape.Place
          (
          CGame
          game,

          CPlayer
          player,

          Vector2
          tile_position

          )

Places wall shape into construction map.

Parameters

game	Game updating

player	Player placing shape

tile_position	Position placing shape

Returns

          final void game.CWallShape.Randomize
          (
          int
          val	)

Sets type and orientation of polyomino.

Parameters

val	Seed value

The documentation for this class was generated from the following file:

android/src/game/CWallShape.java

<address class="footer">
Generated on Sun Mar 15 2015 22:20:52 for ECS160Android by

 1.8.9.1
</address>


text:
import rospy
from flexbe_core import EventState, Logger

'''
Created on 25.05.2017
@author: Philippe La Madeleine
'''

class FIFO_Get(EventState):
    '''
    Take away the last entry from a FIFO
    ># FIFO     object        The FIFO in which we want to add an entry.
    <# Out      object        The value on top of the FIFO.
    '''

    def __init__(self):
        '''
        Constructor
        '''
        super(FIFO_Get, self).__init__(outcomes = ['done','empty'],
                                            input_keys=['FIFO'],
                                            output_keys = ['Out'])

    def execute(self, userdata):
        '''
        Execute this state
        '''
        Count = 0
        for i in userdata.FIFO:
            Count = Count+1
        if ( Count > 0 ):
            userdata.Out = userdata.FIFO[0]
            Count = Count-1
            while Count > 0:
                userdata.FIFO[Count-1] = userdata.FIFO[Count]
                Count = Count-1
            userdata.FIFO.pop()
            return "done"
        else:
            return "empty"

redpajama_set_name: RedPajamaGithub


text:
package parquet.hadoop.thrift;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.List;

import org.apache.hadoop.io.Writable;
import org.apache.hadoop.io.WritableUtils;
import org.apache.hadoop.mapred.Counters;
import org.apache.hadoop.mapred.FileSplit;
import org.apache.hadoop.mapred.InputSplit;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.RecordReader;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapreduce.InputFormat;
import org.apache.hadoop.mapreduce.JobContext;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.StatusReporter;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.TaskAttemptID;
import org.apache.hadoop.mapreduce.TaskInputOutputContext;
import org.apache.hadoop.util.ReflectionUtils;

import com.twitter.elephantbird.util.HadoopUtils;

/**
 * The wrapper enables an {@link InputFormat} written for new
 * mapreduce interface to be used unmodified in contexts where
 * a {@link org.apache.hadoop.mapred.InputFormat} with old mapred
 * interface is required.

 *
 * Instead of returning <K, V> it returns {@link Container}s of <K> and <V>.
 *
 * Usage:

 *    // set InputFormat class using a mapreduce InputFormat
 *    DeprecatedContainerInputFormat.setInputFormat(org.apache.hadoop.mapreduce.lib.input.TextInputFormat.class, jobConf);
 *    jobConf.setOutputFormat(org.apache.hadoop.mapred.TextOutputFormat.class);
 *    // ...
 *

 *
 * TODO: move to Elephant Bird, reduce duplication.
 *
 */
@SuppressWarnings("deprecation")
public class DeprecatedContainerInputFormat<K, V> implements org.apache.hadoop.mapred.InputFormat<Container<K>, Container<V>> {

  private static final String CLASS_CONF_KEY = "elephantbird.class.for.DeprecatedInputFormatWrapper";

  protected InputFormat<K, V> realInputFormat;

  /**
   * Sets jobs input format to {@link DeprecatedInputFormatWrapper} and stores
   * supplied real {@link InputFormat} class name in job configuration.
   * This configuration is read on the remote tasks to instantiate actual
   * InputFormat correctly.
   */
  public static void setInputFormat(Class<?> realInputFormatClass, JobConf jobConf) {
    jobConf.setInputFormat(DeprecatedContainerInputFormat.class);
    HadoopUtils.setClassConf(jobConf, CLASS_CONF_KEY, realInputFormatClass);
  }

  @SuppressWarnings("unchecked")
  private void initInputFormat(JobConf conf) {
    if (realInputFormat == null) {
      realInputFormat = ReflectionUtils.newInstance(
                          conf.getClass(CLASS_CONF_KEY, null, InputFormat.class),
                          conf);
    }
  }

  public DeprecatedContainerInputFormat() {
    // real inputFormat is initialized based on conf.
  }

  public DeprecatedContainerInputFormat(InputFormat<K, V> realInputFormat) {
    this.realInputFormat = realInputFormat;
  }

  @Override
  public RecordReader<Container<K>, Container<V>> getRecordReader(InputSplit split, JobConf job,
                  Reporter reporter) throws IOException {
    initInputFormat(job);
    return new RecordReaderWrapper<K, V>(realInputFormat, split, job, reporter);
  }

  @Override
  public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException {
    initInputFormat(job);

    try {
      List<org.apache.hadoop.mapreduce.InputSplit> splits =
        realInputFormat.getSplits(new Job(job, null));

      if (splits == null) {
        return null;
      }

      InputSplit[] resultSplits = new InputSplit[splits.size()];
      int i = 0;
      for (org.apache.hadoop.mapreduce.InputSplit split : splits) {
        if (split.getClass() == org.apache.hadoop.mapreduce.lib.input.FileSplit.class) {
          org.apache.hadoop.mapreduce.lib.input.FileSplit mapreduceFileSplit =
              ((org.apache.hadoop.mapreduce.lib.input.FileSplit)split);
          resultSplits[i++] = new FileSplit(
              mapreduceFileSplit.getPath(),
              mapreduceFileSplit.getStart(),
              mapreduceFileSplit.getLength(),
              mapreduceFileSplit.getLocations());
        } else {
          resultSplits[i++] = new InputSplitWrapper(split);
        }
      }

      return resultSplits;

    } catch (InterruptedException e) {
      Thread.interrupted();
      throw new IOException(e);
    }
  }

  /**
   * A reporter that works with both mapred and mapreduce APIs.
   */
  private static class ReporterWrapper extends StatusReporter implements Reporter {
    private Reporter wrappedReporter;

    public ReporterWrapper(Reporter reporter) {
      wrappedReporter = reporter;
    }

    @Override
    public Counters.Counter getCounter(Enum<?> anEnum) {
      return wrappedReporter.getCounter(anEnum);
    }

    @Override
    public Counters.Counter getCounter(String s, String s1) {
      return wrappedReporter.getCounter(s, s1);
    }

    @Override
    public void incrCounter(Enum<?> anEnum, long l) {
      wrappedReporter.incrCounter(anEnum, l);
    }

    @Override
    public void incrCounter(String s, String s1, long l) {
      wrappedReporter.incrCounter(s, s1, l);
    }

    @Override
    public InputSplit getInputSplit() throws UnsupportedOperationException {
      return wrappedReporter.getInputSplit();
    }

    @Override
    public void progress() {
      wrappedReporter.progress();
    }

    @Override
    public void setStatus(String s) {
      wrappedReporter.setStatus(s);
    }
  }

  private static class RecordReaderWrapper<K, V> implements RecordReader<Container<K>, Container<V>> {

    private org.apache.hadoop.mapreduce.RecordReader<K, V> realReader;
    private long splitLen; // for getPos()

    // expect readReader return same Key & Value objects (common case)
    // this avoids extra serialization & deserialazion of these objects
    private Container<K> keyContainer = null;
    private Container<V> valueContainer = null;

    private boolean firstRecord = false;
    private boolean eof = false;

    public RecordReaderWrapper(InputFormat<K, V> newInputFormat,
                               InputSplit oldSplit,
                               JobConf oldJobConf,
                               Reporter reporter) throws IOException {

      splitLen = oldSplit.getLength();

      org.apache.hadoop.mapreduce.InputSplit split;
      if (oldSplit.getClass() == FileSplit.class) {
        split = new org.apache.hadoop.mapreduce.lib.input.FileSplit(
            ((FileSplit)oldSplit).getPath(),
            ((FileSplit)oldSplit).getStart(),
            ((FileSplit)oldSplit).getLength(),
            oldSplit.getLocations());
      } else {
        split = ((InputSplitWrapper)oldSplit).realSplit;
      }

      TaskAttemptID taskAttemptID = TaskAttemptID.forName(oldJobConf.get("mapred.task.id"));
      if (taskAttemptID == null) {
        taskAttemptID = new TaskAttemptID();
      }

      // create a TaskInputOutputContext
      @SuppressWarnings("unchecked")
      TaskAttemptContext taskContext =
        new TaskInputOutputContext(oldJobConf, taskAttemptID,
            null, null, new ReporterWrapper(reporter)) {

              @Override
              public Object getCurrentKey() throws IOException, InterruptedException {
                throw new RuntimeException("not implemented");
              }
              @Override
              public Object getCurrentValue() throws IOException, InterruptedException {
                throw new RuntimeException("not implemented");
              }
              @Override
              public boolean nextKeyValue() throws IOException, InterruptedException {
                throw new RuntimeException("not implemented");
              }
      };

      try {
        realReader = newInputFormat.createRecordReader(split, taskContext);
        realReader.initialize(split, taskContext);

        // read once to gain access to key and value objects
        if (realReader.nextKeyValue()) {
          firstRecord = true;
          keyContainer = new Container<K>();
          keyContainer.set(realReader.getCurrentKey());
          valueContainer = new Container<V>();
          valueContainer.set(realReader.getCurrentValue());

        } else {
          eof = true;
        }
      } catch (InterruptedException e) {
        Thread.interrupted();
        throw new IOException(e);
      }
    }

    @Override
    public void close() throws IOException {
      realReader.close();
    }

    @Override
    public Container<K> createKey() {
      return keyContainer;
    }

    @Override
    public Container<V> createValue() {
      return valueContainer;
    }

    @Override
    public long getPos() throws IOException {
      return (long) (splitLen * getProgress());
    }

    @Override
    public float getProgress() throws IOException {
      try {
        return realReader.getProgress();
      } catch (InterruptedException e) {
        Thread.interrupted();
        throw new IOException(e);
      }
    }

    @Override
    public boolean next(Container<K> key, Container<V> value) throws IOException {
      if (eof) {
        return false;
      }

      if (firstRecord) { // key & value are already read.
        firstRecord = false;
        return true;
      }

      try {
        if (realReader.nextKeyValue()) {
          if (key != null) key.set(realReader.getCurrentKey());
          if (value != null) value.set(realReader.getCurrentValue());
          return true;
        }
      } catch (InterruptedException e) {
        throw new IOException(e);
      }

      eof = true; // strictly not required, just for consistency
      return false;
    }
  }

  private static class InputSplitWrapper implements InputSplit {

    org.apache.hadoop.mapreduce.InputSplit realSplit;

    @SuppressWarnings("unused") // MapReduce instantiates this.
    public InputSplitWrapper() {}

    public InputSplitWrapper(org.apache.hadoop.mapreduce.InputSplit realSplit) {
      this.realSplit = realSplit;
    }

    @Override
    public long getLength() throws IOException {
      try {
        return realSplit.getLength();
      } catch (InterruptedException e) {
        Thread.interrupted();
        throw new IOException(e);
      }
    }

    @Override
    public String[] getLocations() throws IOException {
      try {
        return realSplit.getLocations();
      } catch (InterruptedException e) {
        Thread.interrupted();
        throw new IOException(e);
      }
    }

    @Override
    public void readFields(DataInput in) throws IOException {
      String className = WritableUtils.readString(in);
      Class<?> splitClass;

      try {
        splitClass = Class.forName(className);
      } catch (ClassNotFoundException e) {
        throw new IOException(e);
      }

      realSplit = (org.apache.hadoop.mapreduce.InputSplit)
                  ReflectionUtils.newInstance(splitClass, null);
      ((Writable)realSplit).readFields(in);
    }

    @Override
    public void write(DataOutput out) throws IOException {
      WritableUtils.writeString(out, realSplit.getClass().getName());
      ((Writable)realSplit).write(out);
    }
  }
}


text:
package edu.isi.karma.mapreduce.driver;

import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

import edu.isi.karma.mapreduce.inputformat.ZIPInputFormat;

public class XMLElementExtractorProcessor extends Configured implements Tool{

	public  Job configure(Properties p ) throws Exception
	{

		Configuration conf = getConf();
		if(p.getProperty("fs.default.name") != null)
		{
			conf.setIfUnset("fs.default.name", p.getProperty("fs.default.name"));
		}
		if(p.getProperty("mapred.job.tracker")!= null)
		{
			conf.setIfUnset("mapred.job.tracker", p.getProperty("mapred.job.tracker"));
		}
		if(p.getProperty("karma.extraction.xml.tag") != null)
		{
			conf.setIfUnset("karma.extraction.xml.tag", p.getProperty("karma.extraction.xml.tag"));
		}
		if(p.getProperty("karma.extraction.xml.prologue") != null)
		{
			conf.setIfUnset("karma.extraction.xml.prologue", p.getProperty("karma.extraction.xml.prologue"));
		}
		if(p.getProperty("karma.extraction.xml.epilogue") != null)
		{
			conf.setIfUnset("karma.extraction.xml.epilogue", p.getProperty("karma.extraction.xml.epilogue"));
		}
		Job job = Job.getInstance(conf);
    job.setInputFormatClass(ZIPInputFormat.class);
    job.setJarByClass(XMLElementExtractorProcessor.class);
    job.setOutputFormatClass(SequenceFileOutputFormat.class);
    job.setMapperClass(XMLElementExtractorMapper.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(Text.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);
    String[] paths = p.getProperty("input.directory").split(",");
    Path[] array = new Path[paths.length];
    int i = 0;
    for (String path : paths) {
    	array[i++] = new Path(path);
    }
    FileInputFormat.setInputPaths(job, array);
    FileOutputFormat.setOutputPath(job, new Path(p.getProperty("output.directory")));

    job.setNumReduceTasks(0);
    return job;
 }

   public static void main(String[] args) throws Exception {
	   System.exit(ToolRunner.run(new Configuration(), new XMLElementExtractorProcessor(), args));
   }

	 public int run(String[] args) throws Exception {
		 Properties p = new Properties();
		 p.load(new FileInputStream(new File(args[0])));

         Job job = configure(p);

         if(!job.waitForCompletion(true))
         {
        	 System.err.println("Unable to finish job");
        	 return -1;
         }

         return 0;
       }

}


text:
class GobjectIntrospection < Formula
  desc "Generate interface introspection data for GObject libraries"
  homepage "https://live.gnome.org/GObjectIntrospection"
  url "http://ftp.gnome.org/pub/GNOME/sources/gobject-introspection/1.44/gobject-introspection-1.44.0.tar.xz"
  sha256 "6f0c2c28aeaa37b5037acbf21558098c4f95029b666db755d3a12c2f1e1627ad"

  bottle do
    revision 2
    sha256 "e29497a4aa084f25f7d53988beab1999c4b3145896f0ef6a993b0d7736269cbd" => :yosemite
    sha256 "1e0e84d4d114f39d89549bc5a6bfae59a84655a1aefce926d8dd6e53495390ae" => :mavericks
    sha256 "3dcfedfe989ec4d9c6558def0190ef3bd3214bafa4d2f53fd28aa1abbc1403f2" => :mountain_lion
  end

  option :universal
  option "with-tests", "Run tests in addition to the build (requires cairo)"

  depends_on "pkg-config" => :run
  depends_on "glib"
  depends_on "libffi"
  depends_on "cairo" => :build if build.with? "tests"
  depends_on "bison" unless OS.mac?
  depends_on "flex" unless OS.mac?

  # Allow tests to execute on OS X (.so => .dylib)
  patch do
    url "https://gist.githubusercontent.com/krrk/6958869/raw/de8d83009d58eefa680a590f5839e61a6e76ff76/gobject-introspection-tests.patch"
    sha1 "1f57849db76cd2ca26ddb35dc36c373606414dfc"
  end if build.with? "tests"

  resource "tutorial" do
    url "https://gist.github.com/7a0023656ccfe309337a.git",
        :revision => "499ac89f8a9ad17d250e907f74912159ea216416"
  end

  def install
    ENV["GI_SCANNER_DISABLE_CACHE"] = "true"
    ENV.universal_binary if build.universal?
    inreplace "giscanner/transformer.py", "/usr/share", "#{HOMEBREW_PREFIX}/share"
    inreplace "configure" do |s|
      s.change_make_var! "GOBJECT_INTROSPECTION_LIBDIR", "#{HOMEBREW_PREFIX}/lib"
    end

    args = %W[--disable-dependency-tracking --prefix=#{prefix}]
    args << "--with-cairo" if build.with? "tests"

    system "./configure", *args
    system "make"
    system "make", "check" if build.with? "tests"
    system "make", "install"
  end

  test do
    ENV.prepend_path "PKG_CONFIG_PATH", Formula["libffi"].opt_lib/"pkgconfig"
    resource("tutorial").stage testpath
    system "make"
    assert (testpath/"Tut-0.1.typelib").exist?
  end
end


text:
package ru.job4j.dsagai.exam.client.view;

import ru.job4j.dsagai.exam.server.game.round.GameCell;
import ru.job4j.dsagai.exam.server.game.round.GameField;

/**
 * Interface of view part of game client.
 *
 * @author dsagai
 * @version 1.00
 * @since 18.02.2017
 */
public interface View {

    /**
     * informs client, that server waits turn from him.
     */
    void turnRequest();

    /**
     * sends to the client updated game field.
     * @param cell GameCell
     */
    void updateField(GameCell cell);

    /**
     * inits client side GameField object.
     * @param fieldSize int.
     */
    void initField(int fieldSize);

    /**
     * informs client, what he was disconnected
     * from game session.
     */
    void disconnectSession();

    /**
     * sends text message to the client
     * @param text String.
     */
    void showText(String text);

}


text:
<?php namespace Draw\Swagger;

use Draw\Swagger\Schema\Mixed;
use Draw\Swagger\Schema\SecurityRequirement;
use JMS\Serializer\Context;
use JMS\Serializer\GraphNavigatorInterface;
use JMS\Serializer\Handler\SubscribingHandlerInterface;
use JMS\Serializer\JsonDeserializationVisitor;
use JMS\Serializer\JsonSerializationVisitor;

class JMSSerializerHandler implements SubscribingHandlerInterface
{
    public static function getSubscribingMethods()
    {
        return [
            [
                'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
                'format' => 'json',
                'type' => SecurityRequirement::class,
                'method' => 'serializeSecurityRequirementToJson',
            ],
            [
                'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION,
                'format' => 'json',
                'type' => SecurityRequirement::class,
                'method' => 'deserializeSecurityRequirementToJson',
            ],
            [
                'direction' => GraphNavigatorInterface::DIRECTION_SERIALIZATION,
                'format' => 'json',
                'type' => Mixed::class,
                'method' => 'serializeMixedToJson',
            ],
            [
                'direction' => GraphNavigatorInterface::DIRECTION_DESERIALIZATION,
                'format' => 'json',
                'type' => Mixed::class,
                'method' => 'deserializeMixedToJson',
            ],
        ];
    }

    /**
     * @param JsonSerializationVisitor $visitor
     * @param SecurityRequirement $securityRequirement
     * @param array $type
     * @param Context $context
     * @return mixed
     */
    public function serializeSecurityRequirementToJson(
        JsonSerializationVisitor $visitor,
        SecurityRequirement $securityRequirement,
        array $type,
        Context $context
    ) {
        return $securityRequirement->getData();
    }

    /**
     * @param JsonDeserializationVisitor $visitor
     * @param SecurityRequirement $data
     * @param array $type
     * @param Context $context
     * @return SecurityRequirement
     */
    public function deserializeSecurityRequirementToJson(
        JsonDeserializationVisitor $visitor,
        $data,
        array $type,
        Context $context
    ) {
        $securityRequirement = new SecurityRequirement();
        $securityRequirement->setData($data);
        return $securityRequirement;
    }

    /**
     * @param JsonSerializationVisitor $visitor
     * @param Mixed $mixed
     * @param array $type
     * @param Context $context
     * @return mixed
     */
    public function serializeMixedToJson(
        JsonSerializationVisitor $visitor,
        Mixed $mixed,
        array $type,
        Context $context
    ) {
        return $mixed->data;
    }

    /**
     * @param JsonDeserializationVisitor $visitor
     * @param SecurityRequirement $data
     * @param array $type
     * @param Context $context
     * @return Mixed
     */
    public function deserializeMixedToJson(
        JsonDeserializationVisitor $visitor,
        $data,
        array $type,
        Context $context
    ) {
        return new Mixed($data);
    }
}


text:
[![Build Status](https://travis-ci.org/roswell/roswell.svg?branch=master)](https://travis-ci.org/roswell/roswell)
[![Quicklisp](http://quickdocs.org/badge/roswell.svg)](http://quickdocs.org/roswell/)

Roswell is a Lisp implementation installer/manager, launcher, and much more!

Roswell started out as a command-line tool with the aim to make installing and managing Common Lisp implementations really simple and easy.

Roswell has now evolved into a full-stack environment for Common Lisp development, and has many features that makes it easy to test, share, and distribute your Lisp applications.
With Roswell, we aim to push the Common Lisp community to a whole new level of productivity.

Roswell is still in beta. Despite this, the basic interfaces are stable and not likely to change. Roswell currently works well on Unix-like platforms such as Linux, macOS and FreeBSD.
Roswell also works on other operating systems, but currently some parts or features might be missing or unstable.

Checkout [issues list](https://github.com/roswell/roswell/issues) if you are interested in what's lacking.

## Installation, Dependency & Usage

See our [github wiki](https://github.com/roswell/roswell/wiki).
We provide prebuilt binaries for homebrew on macOS, various Linux distributions and **also on Windows**.
* [Linux](https://github.com/roswell/roswell/wiki/Installation#linux)
* [FreeBSD](https://github.com/roswell/roswell/wiki/Installation#freebsd)
* [macOS (via Homebrew)](https://github.com/roswell/roswell/wiki/Installation#mac-os-x--homebrew)
* [Windows](https://github.com/roswell/roswell/wiki/Installation#windows)
* [Building from Source](https://github.com/roswell/roswell/wiki/Installation#building-from-source)

## Features

[Feature comparison is available!](https://github.com/roswell/roswell/wiki/How-is-Roswell-different)

* Implementation Manager
* Scripting environment (similar to cl-launch)
* Building utility (similar to buildapp)
* **Novel** : Easier setup for initializing a script
* **Novel** : Better integration to the command-line interface (Bash completion, etc)
* **Novel** : Infrastructure for bundling/installing the scripts to/from a quicklisp system
* **Novel** : Better support for Windows environment (tested exhaustively)
* **Novel** : Better integration to CI environment (e.g. [Travis-CI](https://github.com/roswell/roswell/wiki/Travis-CI), [CircleCI](https://github.com/roswell/roswell/wiki/Circle-CI), [Coveralls](https://github.com/roswell/roswell/wiki/Coveralls))

## Usage

Roswell has git-like subcommands which resemble that of cl-launch, buildapp.

```
$ ros
Common Lisp environment setup Utility.

Usage:

   ros [options] Command [arguments...]
or
   ros [options] [[--] script-path arguments...]

commands:
   run       Run repl
   install   Install a given implementation or a system for roswell environment
   update    Update installed systems.
   build     Make executable from script.
   use       Change default implementation.
   init      Creates a new ros script, optionally based on a template.
   list      List Information
   delete    Delete installed implementations
   config    Get and set options
   version   Show the roswell version information

Use "ros help [command]" for more information about a command.

Additional help topics:

   options

Use "ros help [topic]" for more information about the topic.
```

### Managing/Installing Several Lisp Installations

    $ ros install               # displays a list of all installable implementations

    $ ros install sbcl-bin      # default sbcl
    $ ros install sbcl          # The newest released version of sbcl
    $ ros install ccl-bin       # default prebuilt binary of ccl
    $ ros install sbcl/1.2.0    # A specific version of sbcl

    $ ros list installed sbcl   # Listing the installed implementations
    $ ros run -- --version      # check which implementation is used
    SBCL 1.2.15
    $ ros use sbcl/1.2.3        # change the default implementation

To use an implementation that was not installed by roswell, use i.e. `ros use sbcl/system`.

The list of supported implementations continues to grow!

By default roswell downloads the default stable lisp implementation (sbcl-bin). To use system implementation from the start run `ros lisp=sbcl-bin/system setup` before anything else.

### Installing scripts

It is also possible to install scripts using `ros install`:

    $ ros install qlot            # will install a program from quicklisp
    $ ros install fukamachi/qlot  # will install it from the GitHub

To add installable scripts into the system, you need to put roswell
scripts (files having `.ros` extensions) into a `roswell` subdirectory.
Take a look at [qlot's roswell/qlot.ros](https://github.com/fukamachi/qlot/tree/master/roswell).

### Scripting with Roswell

```diff
$ ros init
Usage: ros init [template] name [options...]

$ ros init fact
Successfully generated: fact.ros

$ emacs fact.ros
## editing the fact.ros ...

$ cat fact.ros
#!/bin/sh
#|-*- mode:lisp -*-|#
#|
exec ros -Q -- $0 "$@"
|#

(defun fact (n)
  (if (zerop n)
      1
      (* n (fact (1- n)))))

(defun main (n &rest argv)
  (declare (ignore argv))
  (format t "~&Factorial ~D = ~D~%" n (fact (parse-integer n))))

$ ./fact.ros 10
Factorial 10 = 3628800
```

## Chef recipe for roswell

[@Rudolph-Miller](https://github.com/Rudolph-Miller) is providing a Chef recipe for setting roswell up.

- [Rudolph-Miller/chef-roswell](https://github.com/Rudolph-Miller/chef-roswell)

## Roswell with CircleCI

[@fukamachi](https://github.com/fukamachi) use Roswell with CircleCI.

- [fukamachi/legion/circle.yml](https://github.com/fukamachi/legion/blob/master/circle.yml)

## Naming Origin 'roswell'
From '[made with secret alien technology](http://www.lisperati.com/logo.html)'.

I felt making it easier to use Lisp for people is a kind of making opportunity for humanbeings to mingle with alien technology. I recall 'roswell incident' by the concept. I'm not sure what you feel.

## See Also
+ [cl-launch](http://cliki.net/cl-launch) : influenced by the project of command line parameters design.

## Author
SANO Masatoshi (snmsts@gmail.com)

## Contributors
 * Eitaro Fukamachi (e.arrows@gmail.com)
 * Tomoya KAWANISHI (chopsticks.tk.ppfm@gmail.com)
 * Masataro Asai (guicho2.71828@gmail.com)

## Special Thanks to
 * Eitaro Fukamachi (e.arrows@gmail.com) for naming this project.
 * Sunrin SHIMURA for [sionescu/cim](https://github.com/sionescu/CIM) that motivate me to start this project.

## Project
 * https://github.com/roswell/roswell

## License
Licensed under the MIT License.


text:
import unittest
from test import test_support
import operator
from sys import maxint
maxsize = test_support.MAX_Py_ssize_t
minsize = -maxsize-1

class oldstyle:
    def __index__(self):
        return self.ind

class newstyle(object):
    def __index__(self):
        return self.ind

class TrapInt(int):
    def __index__(self):
        return self

class TrapLong(long):
    def __index__(self):
        return self

class BaseTestCase(unittest.TestCase):
    def setUp(self):
        self.o = oldstyle()
        self.n = newstyle()

    def test_basic(self):
        self.o.ind = -2
        self.n.ind = 2
        self.assertEqual(operator.index(self.o), -2)
        self.assertEqual(operator.index(self.n), 2)

    def test_slice(self):
        self.o.ind = 1
        self.n.ind = 2
        slc = slice(self.o, self.o, self.o)
        check_slc = slice(1, 1, 1)
        self.assertEqual(slc.indices(self.o), check_slc.indices(1))
        slc = slice(self.n, self.n, self.n)
        check_slc = slice(2, 2, 2)
        self.assertEqual(slc.indices(self.n), check_slc.indices(2))

    def test_wrappers(self):
        self.o.ind = 4
        self.n.ind = 5
        self.assertEqual(6 .__index__(), 6)
        self.assertEqual(-7L.__index__(), -7)
        self.assertEqual(self.o.__index__(), 4)
        self.assertEqual(self.n.__index__(), 5)
        self.assertEqual(True.__index__(), 1)
        self.assertEqual(False.__index__(), 0)

    def test_subclasses(self):
        r = range(10)
        self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10])
        self.assertEqual(r[TrapLong(5):TrapLong(10)], r[5:10])
        self.assertEqual(slice(TrapInt()).indices(0), (0,0,1))
        self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1))

    def test_error(self):
        self.o.ind = 'dumb'
        self.n.ind = 'bad'
        self.assertRaises(TypeError, operator.index, self.o)
        self.assertRaises(TypeError, operator.index, self.n)
        self.assertRaises(TypeError, slice(self.o).indices, 0)
        self.assertRaises(TypeError, slice(self.n).indices, 0)

class SeqTestCase(unittest.TestCase):
    # This test case isn't run directly. It just defines common tests
    # to the different sequence types below
    def setUp(self):
        self.o = oldstyle()
        self.n = newstyle()
        self.o2 = oldstyle()
        self.n2 = newstyle()

    def test_index(self):
        self.o.ind = -2
        self.n.ind = 2
        self.assertEqual(self.seq[self.n], self.seq[2])
        self.assertEqual(self.seq[self.o], self.seq[-2])

    def test_slice(self):
        self.o.ind = 1
        self.o2.ind = 3
        self.n.ind = 2
        self.n2.ind = 4
        self.assertEqual(self.seq[self.o:self.o2], self.seq[1:3])
        self.assertEqual(self.seq[self.n:self.n2], self.seq[2:4])

    def test_slice_bug7532a(self):
        seqlen = len(self.seq)
        self.o.ind = int(seqlen * 1.5)
        self.n.ind = seqlen + 2
        self.assertEqual(self.seq[self.o:], self.seq[0:0])
        self.assertEqual(self.seq[:self.o], self.seq)
        self.assertEqual(self.seq[self.n:], self.seq[0:0])
        self.assertEqual(self.seq[:self.n], self.seq)

    def test_slice_bug7532b(self):
        if isinstance(self.seq, ClassicSeq):
            self.skipTest('test fails for ClassicSeq')
        # These tests fail for ClassicSeq (see bug #7532)
        seqlen = len(self.seq)
        self.o2.ind = -seqlen - 2
        self.n2.ind = -int(seqlen * 1.5)
        self.assertEqual(self.seq[self.o2:], self.seq)
        self.assertEqual(self.seq[:self.o2], self.seq[0:0])
        self.assertEqual(self.seq[self.n2:], self.seq)
        self.assertEqual(self.seq[:self.n2], self.seq[0:0])

    def test_repeat(self):
        self.o.ind = 3
        self.n.ind = 2
        self.assertEqual(self.seq * self.o, self.seq * 3)
        self.assertEqual(self.seq * self.n, self.seq * 2)
        self.assertEqual(self.o * self.seq, self.seq * 3)
        self.assertEqual(self.n * self.seq, self.seq * 2)

    def test_wrappers(self):
        self.o.ind = 4
        self.n.ind = 5
        self.assertEqual(self.seq.__getitem__(self.o), self.seq[4])
        self.assertEqual(self.seq.__mul__(self.o), self.seq * 4)
        self.assertEqual(self.seq.__rmul__(self.o), self.seq * 4)
        self.assertEqual(self.seq.__getitem__(self.n), self.seq[5])
        self.assertEqual(self.seq.__mul__(self.n), self.seq * 5)
        self.assertEqual(self.seq.__rmul__(self.n), self.seq * 5)

    def test_subclasses(self):
        self.assertEqual(self.seq[TrapInt()], self.seq[0])
        self.assertEqual(self.seq[TrapLong()], self.seq[0])

    def test_error(self):
        self.o.ind = 'dumb'
        self.n.ind = 'bad'
        indexobj = lambda x, obj: obj.seq[x]
        self.assertRaises(TypeError, indexobj, self.o, self)
        self.assertRaises(TypeError, indexobj, self.n, self)
        sliceobj = lambda x, obj: obj.seq[x:]
        self.assertRaises(TypeError, sliceobj, self.o, self)
        self.assertRaises(TypeError, sliceobj, self.n, self)

class ListTestCase(SeqTestCase):
    seq = [0,10,20,30,40,50]

    def test_setdelitem(self):
        self.o.ind = -2
        self.n.ind = 2
        lst = list('ab!cdefghi!j')
        del lst[self.o]
        del lst[self.n]
        lst[self.o] = 'X'
        lst[self.n] = 'Y'
        self.assertEqual(lst, list('abYdefghXj'))

        lst = [5, 6, 7, 8, 9, 10, 11]
        lst.__setitem__(self.n, "here")
        self.assertEqual(lst, [5, 6, "here", 8, 9, 10, 11])
        lst.__delitem__(self.n)
        self.assertEqual(lst, [5, 6, 8, 9, 10, 11])

    def test_inplace_repeat(self):
        self.o.ind = 2
        self.n.ind = 3
        lst = [6, 4]
        lst *= self.o
        self.assertEqual(lst, [6, 4, 6, 4])
        lst *= self.n
        self.assertEqual(lst, [6, 4, 6, 4] * 3)

        lst = [5, 6, 7, 8, 9, 11]
        l2 = lst.__imul__(self.n)
        self.assertIs(l2, lst)
        self.assertEqual(lst, [5, 6, 7, 8, 9, 11] * 3)

class _BaseSeq:

    def __init__(self, iterable):
        self._list = list(iterable)

    def __repr__(self):
        return repr(self._list)

    def __eq__(self, other):
        return self._list == other

    def __len__(self):
        return len(self._list)

    def __mul__(self, n):
        return self.__class__(self._list*n)
    __rmul__ = __mul__

    def __getitem__(self, index):
        return self._list[index]

class _GetSliceMixin:

    def __getslice__(self, i, j):
        return self._list.__getslice__(i, j)

class ClassicSeq(_BaseSeq): pass
class NewSeq(_BaseSeq, object): pass
class ClassicSeqDeprecated(_GetSliceMixin, ClassicSeq): pass
class NewSeqDeprecated(_GetSliceMixin, NewSeq): pass

class TupleTestCase(SeqTestCase):
    seq = (0,10,20,30,40,50)

class StringTestCase(SeqTestCase):
    seq = "this is a test"

class ByteArrayTestCase(SeqTestCase):
    seq = bytearray("this is a test")

class UnicodeTestCase(SeqTestCase):
    seq = u"this is a test"

class ClassicSeqTestCase(SeqTestCase):
    seq = ClassicSeq((0,10,20,30,40,50))

class NewSeqTestCase(SeqTestCase):
    seq = NewSeq((0,10,20,30,40,50))

class ClassicSeqDeprecatedTestCase(SeqTestCase):
    seq = ClassicSeqDeprecated((0,10,20,30,40,50))

class NewSeqDeprecatedTestCase(SeqTestCase):
    seq = NewSeqDeprecated((0,10,20,30,40,50))

class XRangeTestCase(unittest.TestCase):

    def test_xrange(self):
        n = newstyle()
        n.ind = 5
        self.assertEqual(xrange(1, 20)[n], 6)
        self.assertEqual(xrange(1, 20).__getitem__(n), 6)

class OverflowTestCase(unittest.TestCase):

    def setUp(self):
        self.pos = 2**100
        self.neg = -self.pos

    def test_large_longs(self):
        self.assertEqual(self.pos.__index__(), self.pos)
        self.assertEqual(self.neg.__index__(), self.neg)

    def _getitem_helper(self, base):
        class GetItem(base):
            def __len__(self):
                return maxint # cannot return long here
            def __getitem__(self, key):
                return key
        x = GetItem()
        self.assertEqual(x[self.pos], self.pos)
        self.assertEqual(x[self.neg], self.neg)
        self.assertEqual(x[self.neg:self.pos].indices(maxsize),
                         (0, maxsize, 1))
        self.assertEqual(x[self.neg:self.pos:1].indices(maxsize),
                         (0, maxsize, 1))

    def _getslice_helper_deprecated(self, base):
        class GetItem(base):
            def __len__(self):
                return maxint # cannot return long here
            def __getitem__(self, key):
                return key
            def __getslice__(self, i, j):
                return i, j
        x = GetItem()
        self.assertEqual(x[self.pos], self.pos)
        self.assertEqual(x[self.neg], self.neg)
        self.assertEqual(x[self.neg:self.pos], (maxint+minsize, maxsize))
        self.assertEqual(x[self.neg:self.pos:1].indices(maxsize),
                         (0, maxsize, 1))

    def test_getitem(self):
        self._getitem_helper(object)
        with test_support.check_py3k_warnings():
            self._getslice_helper_deprecated(object)

    def test_getitem_classic(self):
        class Empty: pass
        # XXX This test fails (see bug #7532)
        #self._getitem_helper(Empty)
        with test_support.check_py3k_warnings():
            self._getslice_helper_deprecated(Empty)

    def test_sequence_repeat(self):
        self.assertRaises(OverflowError, lambda: "a" * self.pos)
        self.assertRaises(OverflowError, lambda: "a" * self.neg)

def test_main():
    test_support.run_unittest(
        BaseTestCase,
        ListTestCase,
        TupleTestCase,
        ByteArrayTestCase,
        StringTestCase,
        UnicodeTestCase,
        ClassicSeqTestCase,
        NewSeqTestCase,
        XRangeTestCase,
        OverflowTestCase,
    )
    with test_support.check_py3k_warnings():
        test_support.run_unittest(
            ClassicSeqDeprecatedTestCase,
            NewSeqDeprecatedTestCase,
        )

if __name__ == "__main__":
    test_main()


text:
#include <elog.h>
#include <stdio.h>
#include <windows.h>

#ifdef ELOG_FILE_ENABLE
#include <elog_file.h>
#endif

static HANDLE output_lock = NULL;

/**
 * EasyLogger port initialize
 *
 * @return result
 */
ElogErrCode elog_port_init(void) {
    ElogErrCode result = ELOG_NO_ERR;

    output_lock = CreateMutex(NULL, FALSE, NULL);

#ifdef ELOG_FILE_ENABLE
    elog_file_init();
#endif

    return result;
}

/**
 * EasyLogger port deinitialize
 *
 */
void elog_port_deinit(void) {
#ifdef ELOG_FILE_ENABLE
	elog_file_deinit();
#endif

	CloseHandle(output_lock);
}

/**
 * output log port interface
 *
 * @param log output of log
 * @param size log size
 */
void elog_port_output(const char *log, size_t size) {
    /* output to terminal */
    printf("%.*s", size, log);
#ifdef ELOG_FILE_ENABLE
    /* write the file */
    elog_file_write(log, size);
#endif
}

/**
 * output lock
 */
void elog_port_output_lock(void) {
    WaitForSingleObject(output_lock, INFINITE);
}

/**
 * output unlock
 */
void elog_port_output_unlock(void) {
    ReleaseMutex( output_lock );
}

/**
 * get current time interface
 *
 * @return current time
 */
const char *elog_port_get_time(void) {
    static char cur_system_time[24] = { 0 };
    static SYSTEMTIME currTime;

    GetLocalTime(&currTime);
    snprintf(cur_system_time, 24, "%02d-%02d %02d:%02d:%02d.%03d", currTime.wMonth, currTime.wDay,
            currTime.wHour, currTime.wMinute, currTime.wSecond, currTime.wMilliseconds);

    return cur_system_time;
}

/**
 * get current process name interface
 *
 * @return current process name
 */
const char *elog_port_get_p_info(void) {
    static char cur_process_info[10] = { 0 };

    snprintf(cur_process_info, 10, "pid:%04ld", GetCurrentProcessId());

    return cur_process_info;
}

/**
 * get current thread name interface
 *
 * @return current thread name
 */
const char *elog_port_get_t_info(void) {
    static char cur_thread_info[10] = { 0 };

    snprintf(cur_thread_info, 10, "tid:%04ld", GetCurrentThreadId());

    return cur_thread_info;
}


text:
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse">
        Toggle navigation

      </button>
      xblog

Link

        {% if user.is_authenticated %}

         {{ user.username }}

        {% else %}

          注册

          登录

        {% endif %}


text:
package org.ohdsi.olympus.controller;

import java.io.File;
import java.io.FileReader;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.ohdsi.olympus.model.AppProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/achilles/")
public class AchillesController {

    private static final Log log = LogFactory.getLog(AchillesController.class);

    @Autowired
    private Environment env;

    @RequestMapping(value = "datasources", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public HttpEntity<JSONObject> datasource() {
        final String fileLocation = this.env.getProperty(AppProperties.PROP_ACHILLES_DATA_DIR) + File.separator
                + "datasources.json";
        return new ResponseEntity<JSONObject>(toJson(fileLocation), HttpStatus.OK);
    }

    @RequestMapping(value = "data", method = RequestMethod.GET, produces = "application/json")
    @ResponseBody
    public HttpEntity<JSONObject> datasource(@RequestParam("dataSourceFolder") final String dataSourceFolder,
                                             @RequestParam("file") final String file) {
        final JSONParser parser = new JSONParser();
        JSONObject jsonObject = null;
        try {
            final String fileLocation = this.env.getProperty(AppProperties.PROP_ACHILLES_DATA_DIR) + File.separator
                    + dataSourceFolder + File.separator + file;
            log.debug("Attempting to parse datasources.json from : " + fileLocation);
            final FileReader fr = new FileReader(fileLocation);
            final Object obj = parser.parse(fr);
            jsonObject = (JSONObject) obj;
            fr.close();
        } catch (final Exception e) {
            log.error("Error returning datasources.json", e);
            throw new RuntimeException(e);
        }
        return new ResponseEntity<JSONObject>(jsonObject, HttpStatus.OK);
    }

    private JSONObject toJson(final String fileLocation) {
        JSONObject jsonObject = null;
        try {
            final JSONParser parser = new JSONParser();
            log.debug("Attempting to parse datasources.json from : " + fileLocation);
            final FileReader fr = new FileReader(fileLocation);
            final Object obj = parser.parse(fr);
            jsonObject = (JSONObject) obj;
            fr.close();
        } catch (final Exception e) {
            log.error("Error returning datasources.json", e);
            throw new RuntimeException(e);
        }
        return jsonObject;
    }
}


text:
<!DOCTYPE html>
    <title>Template Test</title>

    <template>
      Hello World!
    </template>


text:
package name.ratson.cordova.sms_receiver;

import android.Manifest;
import android.app.Activity;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;

import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.PluginResult;
import org.json.JSONArray;
import org.json.JSONException;

public class SmsReceiverPlugin extends CordovaPlugin {
    private static final String ACTION_REQUEST_PERMISSION = "requestPermission";
    public final String ACTION_HAS_SMS_POSSIBILITY = "hasSMSPossibility";
    public final String ACTION_RECEIVE_SMS = "startReception";
    public final String ACTION_STOP_RECEIVE_SMS = "stopReception";
    private CallbackContext callbackReceive;
    private SmsReceiver smsReceiver = null;
    private boolean isReceiving = false;
    private int requestCode = 20160916;

    public SmsReceiverPlugin() {
        super();
    }

    @Override
    public boolean execute(String action, JSONArray arg1,
                           final CallbackContext callbackContext) throws JSONException {

        if (ACTION_HAS_SMS_POSSIBILITY.equals(action)) {
            hasSmsPossibility(callbackContext);
            return true;
        } else if (ACTION_RECEIVE_SMS.equals(action)) {
            receiveSms(callbackContext);
            return true;
        } else if (ACTION_STOP_RECEIVE_SMS.equals(action)) {
            stopReceiveSms(callbackContext);
            return true;
        } else if (ACTION_REQUEST_PERMISSION.equals(action)) {
            requestPermission(Manifest.permission.RECEIVE_SMS, callbackContext);
            return true;
        }

        return false;
    }

    private void stopReceiveSms(CallbackContext callbackContext) {
        if (this.smsReceiver != null) {
            smsReceiver.stopReceiving();
        }

        this.isReceiving = false;

        // 1. Stop the receiving context
        PluginResult pluginResult = new PluginResult(
                PluginResult.Status.NO_RESULT);
        pluginResult.setKeepCallback(false);
        this.callbackReceive.sendPluginResult(pluginResult);

        // 2. Send result for the current context
        pluginResult = new PluginResult(
                PluginResult.Status.OK);
        callbackContext.sendPluginResult(pluginResult);
    }

    private void receiveSms(CallbackContext callbackContext) {
        // if already receiving (this case can happen if the startReception is called
        // several times
        if (this.isReceiving) {
            // close the already opened callback ...
            PluginResult pluginResult = new PluginResult(
                    PluginResult.Status.NO_RESULT);
            pluginResult.setKeepCallback(false);
            this.callbackReceive.sendPluginResult(pluginResult);

            // ... before registering a new one to the sms receiver
        }
        this.isReceiving = true;

        if (this.smsReceiver == null) {
            this.smsReceiver = new SmsReceiver();
            IntentFilter fp = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");
            fp.setPriority(1000);
            // fp.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
            this.cordova.getActivity().registerReceiver(this.smsReceiver, fp);
        }

        this.smsReceiver.startReceiving(callbackContext);

        PluginResult pluginResult = new PluginResult(
                PluginResult.Status.NO_RESULT);
        pluginResult.setKeepCallback(true);
        callbackContext.sendPluginResult(pluginResult);
        this.callbackReceive = callbackContext;
    }

    private void hasSmsPossibility(CallbackContext callbackContext) {
        Activity ctx = this.cordova.getActivity();
        if (ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, true));
        } else {
            callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, false));
        }
    }

    private boolean hasPermissionGranted(String type) {
        if (Build.VERSION.SDK_INT < 23) {
            return true;
        }
        return (PackageManager.PERMISSION_GRANTED ==
                ContextCompat.checkSelfPermission(this.cordova.getActivity(), type));
    }

    private void requestPermission(String type, CallbackContext callbackContext) {
        if (!hasPermissionGranted(type)) {
            ActivityCompat.requestPermissions(this.cordova.getActivity(), new String[]{type}, requestCode);
        }
        callbackContext.success();
    }
}


text:
require "google/ads/google_ads/v10/services/google_ads_service_pb"

module Google
  module Ads
    module GoogleAds
      module V10
        module Services
          module GoogleAdsService
            ##
            # Client for the GoogleAdsService service.
            #
            # Service to fetch data and metrics across resources.
            #
            class Client
              include Paths

              # @private
              attr_reader :google_ads_service_stub

              ##
              # Configure the GoogleAdsService Client class.
              #
              # See {::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client::Configuration}
              # for a description of the configuration fields.
              #
              # @example
              #
              #   # Modify the configuration for all GoogleAdsService clients
              #   ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.configure do |config|
              #     config.timeout = 10.0
              #   end
              #
              # @yield [config] Configure the Client client.
              # @yieldparam config [Client::Configuration]
              #
              # @return [Client::Configuration]
              #
              def self.configure
                @configure ||= begin
                  default_config = Client::Configuration.new

                  default_config.timeout = 14_400.0
                  default_config.retry_policy = {
                    initial_delay: 5.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
                  }

                  default_config
                end
                yield @configure if block_given?
                @configure
              end

              ##
              # Configure the GoogleAdsService Client instance.
              #
              # The configuration is set to the derived mode, meaning that values can be changed,
              # but structural changes (adding new fields, etc.) are not allowed. Structural changes
              # should be made on {Client.configure}.
              #
              # See {::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client::Configuration}
              # for a description of the configuration fields.
              #
              # @yield [config] Configure the Client client.
              # @yieldparam config [Client::Configuration]
              #
              # @return [Client::Configuration]
              #
              def configure
                yield @config if block_given?
                @config
              end

              ##
              # Create a new GoogleAdsService client object.
              #
              # @example
              #
              #   # Create a client using the default configuration
              #   client = ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new
              #
              #   # Create a client using a custom configuration
              #   client = ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new do |config|
              #     config.timeout = 10.0
              #   end
              #
              # @yield [config] Configure the GoogleAdsService client.
              # @yieldparam config [Client::Configuration]
              #
              def initialize
                # These require statements are intentionally placed here to initialize
                # the gRPC module only when it's required.
                # See https://github.com/googleapis/toolkit/issues/446
                require "gapic/grpc"
                require "google/ads/google_ads/v10/services/google_ads_service_services_pb"

                # Create the configuration object
                @config = Configuration.new Client.configure

                # Yield the configuration if needed
                yield @config if block_given?

                # Create credentials
                credentials = @config.credentials
                # Use self-signed JWT if the endpoint is unchanged from default,
                # but only if the default endpoint does not have a region prefix.
                enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                                         !@config.endpoint.split(".").first.include?("-")
                credentials ||= Credentials.default scope: @config.scope,
                                                    enable_self_signed_jwt: enable_self_signed_jwt
                if credentials.is_a?(::String) || credentials.is_a?(::Hash)
                  credentials = Credentials.new credentials, scope: @config.scope
                end
                @quota_project_id = @config.quota_project
                @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

                @google_ads_service_stub = ::Gapic::ServiceStub.new(
                  ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Stub,
                  credentials:  credentials,
                  endpoint:     @config.endpoint,
                  channel_args: @config.channel_args,
                  interceptors: @config.interceptors
                )
              end

              # Service calls

              ##
              # Returns all rows that match the search query.
              #
              # List of thrown errors:
              #   [AuthenticationError]()
              #   [AuthorizationError]()
              #   [ChangeEventError]()
              #   [ChangeStatusError]()
              #   [ClickViewError]()
              #   [HeaderError]()
              #   [InternalError]()
              #   [QueryError]()
              #   [QuotaError]()
              #   [RequestError]()
              #
              # @overload search(request, options = nil)
              #   Pass arguments to `search` via a request object, either of type
              #   {::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
              #
              # @overload search(customer_id: nil, query: nil, page_token: nil, page_size: nil, validate_only: nil, return_total_results_count: nil, summary_row_setting: nil)
              #   Pass arguments to `search` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param customer_id [::String]
              #     Required. The ID of the customer being queried.
              #   @param query [::String]
              #     Required. The query string.
              #   @param page_token [::String]
              #     Token of the page to retrieve. If not specified, the first
              #     page of results will be returned. Use the value obtained from
              #     `next_page_token` in the previous response in order to request
              #     the next page of results.
              #   @param page_size [::Integer]
              #     Number of elements to retrieve in a single page.
              #     When too large a page is requested, the server may decide to
              #     further limit the number of returned resources.
              #   @param validate_only [::Boolean]
              #     If true, the request is validated but not executed.
              #   @param return_total_results_count [::Boolean]
              #     If true, the total number of results that match the query ignoring the
              #     LIMIT clause will be included in the response.
              #     Default is false.
              #   @param summary_row_setting [::Google::Ads::GoogleAds::V10::Enums::SummaryRowSettingEnum::SummaryRowSetting]
              #     Determines whether a summary row will be returned. By default, summary row
              #     is not returned. If requested, the summary row will be sent in a response
              #     by itself after all other query results are returned.
              #
              # @yield [response, operation] Access the result along with the RPC operation
              # @yieldparam response [::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V10::Services::GoogleAdsRow>]
              # @yieldparam operation [::GRPC::ActiveCall::Operation]
              #
              # @return [::Gapic::PagedEnumerable<::Google::Ads::GoogleAds::V10::Services::GoogleAdsRow>]
              #
              # @raise [Google::Ads::GoogleAds::Error] if the RPC is aborted.
              #
              # @example Basic example
              #   require "google/ads/google_ads/v10/services"
              #
              #   # Create a client object. The client can be reused for multiple calls.
              #   client = Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new
              #
              #   # Create a request. To set request fields, pass in keyword arguments.
              #   request = Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsRequest.new
              #
              #   # Call the search method.
              #   result = client.search request
              #
              #   # The returned object is of type Gapic::PagedEnumerable. You can
              #   # iterate over all elements by calling #each, and the enumerable
              #   # will lazily make API calls to fetch subsequent pages. Other
              #   # methods are also available for managing paging directly.
              #   result.each do |response|
              #     # Each element is of type ::Google::Ads::GoogleAds::V10::Services::GoogleAdsRow.
              #     p response
              #   end
              #
              def search request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request,
                                                   to: ::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                metadata = @config.rpcs.search.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Ads::GoogleAds::VERSION
                metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                header_params = {}
                if request.customer_id
                  header_params["customer_id"] = request.customer_id
                end

                request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
                metadata[:"x-goog-request-params"] ||= request_params_header

                options.apply_defaults timeout:      @config.rpcs.search.timeout,
                                       metadata:     metadata,
                                       retry_policy: @config.rpcs.search.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @google_ads_service_stub.call_rpc :search, request, options: options do |response, operation|
                  response = ::Gapic::PagedEnumerable.new @google_ads_service_stub, :search, request, response,
                                                          operation, options
                  yield response, operation if block_given?
                  return response
                end
                # rescue GRPC::BadStatus => grpc_error
                #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
              end

              ##
              # Returns all rows that match the search stream query.
              #
              # List of thrown errors:
              #   [AuthenticationError]()
              #   [AuthorizationError]()
              #   [ChangeEventError]()
              #   [ChangeStatusError]()
              #   [ClickViewError]()
              #   [HeaderError]()
              #   [InternalError]()
              #   [QueryError]()
              #   [QuotaError]()
              #   [RequestError]()
              #
              # @overload search_stream(request, options = nil)
              #   Pass arguments to `search_stream` via a request object, either of type
              #   {::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
              #
              # @overload search_stream(customer_id: nil, query: nil, summary_row_setting: nil)
              #   Pass arguments to `search_stream` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param customer_id [::String]
              #     Required. The ID of the customer being queried.
              #   @param query [::String]
              #     Required. The query string.
              #   @param summary_row_setting [::Google::Ads::GoogleAds::V10::Enums::SummaryRowSettingEnum::SummaryRowSetting]
              #     Determines whether a summary row will be returned. By default, summary row
              #     is not returned. If requested, the summary row will be sent in a response
              #     by itself after all other query results are returned.
              #
              # @yield [response, operation] Access the result along with the RPC operation
              # @yieldparam response [::Enumerable<::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamResponse>]
              # @yieldparam operation [::GRPC::ActiveCall::Operation]
              #
              # @return [::Enumerable<::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamResponse>]
              #
              # @raise [Google::Ads::GoogleAds::Error] if the RPC is aborted.
              #
              # @example Basic example
              #   require "google/ads/google_ads/v10/services"
              #
              #   # Create a client object. The client can be reused for multiple calls.
              #   client = Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new
              #
              #   # Create a request. To set request fields, pass in keyword arguments.
              #   request = Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamRequest.new
              #
              #   # Call the search_stream method.
              #   result = client.search_stream request
              #
              #   # The returned object is a streamed enumerable yielding elements of
              #   # type ::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamResponse.
              #   result.each do |response|
              #     p response
              #   end
              #
              def search_stream request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request,
                                                   to: ::Google::Ads::GoogleAds::V10::Services::SearchGoogleAdsStreamRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                metadata = @config.rpcs.search_stream.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Ads::GoogleAds::VERSION
                metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                header_params = {}
                if request.customer_id
                  header_params["customer_id"] = request.customer_id
                end

                request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
                metadata[:"x-goog-request-params"] ||= request_params_header

                options.apply_defaults timeout:      @config.rpcs.search_stream.timeout,
                                       metadata:     metadata,
                                       retry_policy: @config.rpcs.search_stream.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @google_ads_service_stub.call_rpc :search_stream, request, options: options do |response, operation|
                  yield response, operation if block_given?
                  return response
                end
                # rescue GRPC::BadStatus => grpc_error
                #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
              end

              ##
              # Creates, updates, or removes resources. This method supports atomic
              # transactions with multiple types of resources. For example, you can
              # atomically create a campaign and a campaign budget, or perform up to
              # thousands of mutates atomically.
              #
              # This method is essentially a wrapper around a series of mutate methods. The
              # only features it offers over calling those methods directly are:
              #
              # - Atomic transactions
              # - Temp resource names (described below)
              # - Somewhat reduced latency over making a series of mutate calls
              #
              # Note: Only resources that support atomic transactions are included, so this
              # method can't replace all calls to individual services.
              #
              # ## Atomic Transaction Benefits
              #
              # Atomicity makes error handling much easier. If you're making a series of
              # changes and one fails, it can leave your account in an inconsistent state.
              # With atomicity, you either reach the desired state directly, or the request
              # fails and you can retry.
              #
              # ## Temp Resource Names
              #
              # Temp resource names are a special type of resource name used to create a
              # resource and reference that resource in the same request. For example, if a
              # campaign budget is created with `resource_name` equal to
              # `customers/123/campaignBudgets/-1`, that resource name can be reused in
              # the `Campaign.budget` field in the same request. That way, the two
              # resources are created and linked atomically.
              #
              # To create a temp resource name, put a negative number in the part of the
              # name that the server would normally allocate.
              #
              # Note:
              #
              # - Resources must be created with a temp name before the name can be reused.
              #   For example, the previous CampaignBudget+Campaign example would fail if
              #   the mutate order was reversed.
              # - Temp names are not remembered across requests.
              # - There's no limit to the number of temp names in a request.
              # - Each temp name must use a unique negative number, even if the resource
              #   types differ.
              #
              # ## Latency
              #
              # It's important to group mutates by resource type or the request may time
              # out and fail. Latency is roughly equal to a series of calls to individual
              # mutate methods, where each change in resource type is a new call. For
              # example, mutating 10 campaigns then 10 ad groups is like 2 calls, while
              # mutating 1 campaign, 1 ad group, 1 campaign, 1 ad group is like 4 calls.
              #
              # List of thrown errors:
              #   [AdCustomizerError]()
              #   [AdError]()
              #   [AdGroupAdError]()
              #   [AdGroupCriterionError]()
              #   [AdGroupError]()
              #   [AssetError]()
              #   [AuthenticationError]()
              #   [AuthorizationError]()
              #   [BiddingError]()
              #   [CampaignBudgetError]()
              #   [CampaignCriterionError]()
              #   [CampaignError]()
              #   [CampaignExperimentError]()
              #   [CampaignSharedSetError]()
              #   [CollectionSizeError]()
              #   [ContextError]()
              #   [ConversionActionError]()
              #   [CriterionError]()
              #   [CustomerFeedError]()
              #   [DatabaseError]()
              #   [DateError]()
              #   [DateRangeError]()
              #   [DistinctError]()
              #   [ExtensionFeedItemError]()
              #   [ExtensionSettingError]()
              #   [FeedAttributeReferenceError]()
              #   [FeedError]()
              #   [FeedItemError]()
              #   [FeedItemSetError]()
              #   [FieldError]()
              #   [FieldMaskError]()
              #   [FunctionParsingError]()
              #   [HeaderError]()
              #   [ImageError]()
              #   [InternalError]()
              #   [KeywordPlanAdGroupKeywordError]()
              #   [KeywordPlanCampaignError]()
              #   [KeywordPlanError]()
              #   [LabelError]()
              #   [ListOperationError]()
              #   [MediaUploadError]()
              #   [MutateError]()
              #   [NewResourceCreationError]()
              #   [NullError]()
              #   [OperationAccessDeniedError]()
              #   [PolicyFindingError]()
              #   [PolicyViolationError]()
              #   [QuotaError]()
              #   [RangeError]()
              #   [RequestError]()
              #   [ResourceCountLimitExceededError]()
              #   [SettingError]()
              #   [SharedSetError]()
              #   [SizeLimitError]()
              #   [StringFormatError]()
              #   [StringLengthError]()
              #   [UrlFieldError]()
              #   [UserListError]()
              #   [YoutubeVideoRegistrationError]()
              #
              # @overload mutate(request, options = nil)
              #   Pass arguments to `mutate` via a request object, either of type
              #   {::Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsRequest} or an equivalent Hash.
              #
              #   @param request [::Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsRequest, ::Hash]
              #     A request object representing the call parameters. Required. To specify no
              #     parameters, or to keep all the default parameter values, pass an empty Hash.
              #   @param options [::Gapic::CallOptions, ::Hash]
              #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
              #
              # @overload mutate(customer_id: nil, mutate_operations: nil, partial_failure: nil, validate_only: nil, response_content_type: nil)
              #   Pass arguments to `mutate` via keyword arguments. Note that at
              #   least one keyword argument is required. To specify no parameters, or to keep all
              #   the default parameter values, pass an empty Hash as a request object (see above).
              #
              #   @param customer_id [::String]
              #     Required. The ID of the customer whose resources are being modified.
              #   @param mutate_operations [::Array<::Google::Ads::GoogleAds::V10::Services::MutateOperation, ::Hash>]
              #     Required. The list of operations to perform on individual resources.
              #   @param partial_failure [::Boolean]
              #     If true, successful operations will be carried out and invalid
              #     operations will return errors. If false, all operations will be carried
              #     out in one transaction if and only if they are all valid.
              #     Default is false.
              #   @param validate_only [::Boolean]
              #     If true, the request is validated but not executed. Only errors are
              #     returned, not results.
              #   @param response_content_type [::Google::Ads::GoogleAds::V10::Enums::ResponseContentTypeEnum::ResponseContentType]
              #     The response content type setting. Determines whether the mutable resource
              #     or just the resource name should be returned post mutation. The mutable
              #     resource will only be returned if the resource has the appropriate response
              #     field. E.g. MutateCampaignResult.campaign.
              #
              # @yield [response, operation] Access the result along with the RPC operation
              # @yieldparam response [::Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsResponse]
              # @yieldparam operation [::GRPC::ActiveCall::Operation]
              #
              # @return [::Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsResponse]
              #
              # @raise [Google::Ads::GoogleAds::Error] if the RPC is aborted.
              #
              # @example Basic example
              #   require "google/ads/google_ads/v10/services"
              #
              #   # Create a client object. The client can be reused for multiple calls.
              #   client = Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new
              #
              #   # Create a request. To set request fields, pass in keyword arguments.
              #   request = Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsRequest.new
              #
              #   # Call the mutate method.
              #   result = client.mutate request
              #
              #   # The returned object is of type Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsResponse.
              #   p result
              #
              def mutate request, options = nil
                raise ::ArgumentError, "request must be provided" if request.nil?

                request = ::Gapic::Protobuf.coerce request,
                                                   to: ::Google::Ads::GoogleAds::V10::Services::MutateGoogleAdsRequest

                # Converts hash and nil to an options object
                options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

                # Customize the options with defaults
                metadata = @config.rpcs.mutate.metadata.to_h

                # Set x-goog-api-client and x-goog-user-project headers
                metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
                  lib_name: @config.lib_name, lib_version: @config.lib_version,
                  gapic_version: ::Google::Ads::GoogleAds::VERSION
                metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

                header_params = {}
                if request.customer_id
                  header_params["customer_id"] = request.customer_id
                end

                request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
                metadata[:"x-goog-request-params"] ||= request_params_header

                options.apply_defaults timeout:      @config.rpcs.mutate.timeout,
                                       metadata:     metadata,
                                       retry_policy: @config.rpcs.mutate.retry_policy

                options.apply_defaults timeout:      @config.timeout,
                                       metadata:     @config.metadata,
                                       retry_policy: @config.retry_policy

                @google_ads_service_stub.call_rpc :mutate, request, options: options do |response, operation|
                  yield response, operation if block_given?
                  return response
                end
                # rescue GRPC::BadStatus => grpc_error
                #  raise Google::Ads::GoogleAds::Error.new grpc_error.message
              end

              ##
              # Configuration class for the GoogleAdsService API.
              #
              # This class represents the configuration for GoogleAdsService,
              # providing control over timeouts, retry behavior, logging, transport
              # parameters, and other low-level controls. Certain parameters can also be
              # applied individually to specific RPCs. See
              # {::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client::Configuration::Rpcs}
              # for a list of RPCs that can be configured independently.
              #
              # Configuration can be applied globally to all clients, or to a single client
              # on construction.
              #
              # @example
              #
              #   # Modify the global config, setting the timeout for
              #   # search to 20 seconds,
              #   # and all remaining timeouts to 10 seconds.
              #   ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.configure do |config|
              #     config.timeout = 10.0
              #     config.rpcs.search.timeout = 20.0
              #   end
              #
              #   # Apply the above configuration only to a new client.
              #   client = ::Google::Ads::GoogleAds::V10::Services::GoogleAdsService::Client.new do |config|
              #     config.timeout = 10.0
              #     config.rpcs.search.timeout = 20.0
              #   end
              #
              # @!attribute [rw] endpoint
              #   The hostname or hostname:port of the service endpoint.
              #   Defaults to `"googleads.googleapis.com"`.
              #   @return [::String]
              # @!attribute [rw] credentials
              #   Credentials to send with calls. You may provide any of the following types:
              #    *  (`String`) The path to a service account key file in JSON format
              #    *  (`Hash`) A service account key as a Hash
              #    *  (`Google::Auth::Credentials`) A googleauth credentials object
              #       (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
              #    *  (`Signet::OAuth2::Client`) A signet oauth2 client object
              #       (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
              #    *  (`GRPC::Core::Channel`) a gRPC channel with included credentials
              #    *  (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
              #    *  (`nil`) indicating no credentials
              #   @return [::Object]
              # @!attribute [rw] scope
              #   The OAuth scopes
              #   @return [::Array<::String>]
              # @!attribute [rw] lib_name
              #   The library name as recorded in instrumentation and logging
              #   @return [::String]
              # @!attribute [rw] lib_version
              #   The library version as recorded in instrumentation and logging
              #   @return [::String]
              # @!attribute [rw] channel_args
              #   Extra parameters passed to the gRPC channel. Note: this is ignored if a
              #   `GRPC::Core::Channel` object is provided as the credential.
              #   @return [::Hash]
              # @!attribute [rw] interceptors
              #   An array of interceptors that are run before calls are executed.
              #   @return [::Array<::GRPC::ClientInterceptor>]
              # @!attribute [rw] timeout
              #   The call timeout in seconds.
              #   @return [::Numeric]
              # @!attribute [rw] metadata
              #   Additional gRPC headers to be sent with the call.
              #   @return [::Hash{::Symbol=>::String}]
              # @!attribute [rw] retry_policy
              #   The retry policy. The value is a hash with the following keys:
              #    *  `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
              #    *  `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
              #    *  `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
              #    *  `:retry_codes` (*type:* `Array<String>`) - The error codes that should
              #       trigger a retry.
              #   @return [::Hash]
              # @!attribute [rw] quota_project
              #   A separate project against which to charge quota.
              #   @return [::String]
              #
              class Configuration
                extend ::Gapic::Config

                config_attr :endpoint,      "googleads.googleapis.com", ::String
                config_attr :credentials,   nil do |value|
                  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client,
                             nil]
                  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
                  allowed.any? { |klass| klass === value }
                end
                config_attr :scope,         nil, ::String, ::Array, nil
                config_attr :lib_name,      nil, ::String, nil
                config_attr :lib_version,   nil, ::String, nil
                config_attr(:channel_args,  { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
                config_attr :interceptors,  nil, ::Array, nil
                config_attr :timeout,       nil, ::Numeric, nil
                config_attr :metadata,      nil, ::Hash, nil
                config_attr :retry_policy,  nil, ::Hash, ::Proc, nil
                config_attr :quota_project, nil, ::String, nil

                # @private
                def initialize parent_config = nil
                  @parent_config = parent_config unless parent_config.nil?

                  yield self if block_given?
                end

                ##
                # Configurations for individual RPCs
                # @return [Rpcs]
                #
                def rpcs
                  @rpcs ||= begin
                    parent_rpcs = nil
                    parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
                    Rpcs.new parent_rpcs
                  end
                end

                ##
                # Configuration RPC class for the GoogleAdsService API.
                #
                # Includes fields providing the configuration for each RPC in this service.
                # Each configuration object is of type `Gapic::Config::Method` and includes
                # the following configuration fields:
                #
                #  *  `timeout` (*type:* `Numeric`) - The call timeout in seconds
                #  *  `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
                #  *  `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
                #     include the following keys:
                #      *  `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
                #      *  `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
                #      *  `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
                #      *  `:retry_codes` (*type:* `Array<String>`) - The error codes that should
                #         trigger a retry.
                #
                class Rpcs
                  ##
                  # RPC-specific configuration for `search`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :search
                  ##
                  # RPC-specific configuration for `search_stream`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :search_stream
                  ##
                  # RPC-specific configuration for `mutate`
                  # @return [::Gapic::Config::Method]
                  #
                  attr_reader :mutate

                  # @private
                  def initialize parent_rpcs = nil
                    search_config = parent_rpcs.search if parent_rpcs.respond_to? :search
                    @search = ::Gapic::Config::Method.new search_config
                    search_stream_config = parent_rpcs.search_stream if parent_rpcs.respond_to? :search_stream
                    @search_stream = ::Gapic::Config::Method.new search_stream_config
                    mutate_config = parent_rpcs.mutate if parent_rpcs.respond_to? :mutate
                    @mutate = ::Gapic::Config::Method.new mutate_config

                    yield self if block_given?
                  end
                end
              end
            end
          end
        end
      end
    end
  end
end