text:
'use strict';

describe('overview module', function() {

  beforeEach(module('overview'));

  describe('overview controller', function(){

    it('should ....', inject(function($controller) {
      //spec body
      var view1Ctrl = $controller('OverviewController');
      expect(view1Ctrl).toBeDefined();
    }));

  });
});


text:
Personal website of David Sinclair

## development
- Develop with `yarn start -f`
- Build with `yarn start to-html`

## deployment
- Serverless deployment with `yarn deploy`
- CircleCI handles:
  1. `yarn start -- to-html` for building and testing on all branches
  2. `yarn sync` for AWS S3 sync of build folder on commits to master
  3. `yarn invalidate` for AWS CloudFront invalidation of cache on commits to master
- Serverless removal with `yarn destroy`

## credits
Made from [este](https://github.com/este/este)—thanks for providing such a great resource

redpajama_set_name: RedPajamaGithub


text:
package de.gurkenlabs.litiengine.entities.behavior;

import de.gurkenlabs.litiengine.entities.Entity;

public abstract class EntityTransition<T extends Entity> extends Transition {
  private final T entity;

  protected EntityTransition(final T entity, final int priority) {
    super(priority);
    this.entity = entity;
  }

  public T getEntity() {
    return this.entity;
  }
}


text:
/* GPIO Example

   This example code is in the Public Domain (or CC0 licensed, at your option.)

   Unless required by applicable law or agreed to in writing, this
   software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/queue.h"
#include "driver/gpio.h"

/**
 * Brief:
 * This test code shows how to configure gpio and how to use gpio interrupt.
 *
 * GPIO status:
 * GPIO18: output
 * GPIO19: output
 * GPIO4:  input, pulled up, interrupt from rising edge and falling edge
 * GPIO5:  input, pulled up, interrupt from rising edge.
 *
 * Test:
 * Connect GPIO18 with GPIO4
 * Connect GPIO19 with GPIO5
 * Generate pulses on GPIO18/19, that triggers interrupt on GPIO4/5
 *
 */

#define GPIO_OUTPUT_IO_0    18
#define GPIO_OUTPUT_IO_1    19
#define GPIO_OUTPUT_PIN_SEL  ((1ULL<<GPIO_OUTPUT_IO_0) | (1ULL<<GPIO_OUTPUT_IO_1))
#define GPIO_INPUT_IO_0     4
#define GPIO_INPUT_IO_1     5
#define GPIO_INPUT_PIN_SEL  ((1ULL<<GPIO_INPUT_IO_0) | (1ULL<<GPIO_INPUT_IO_1))
#define ESP_INTR_FLAG_DEFAULT 0

static xQueueHandle gpio_evt_queue = NULL;

static void IRAM_ATTR gpio_isr_handler(void* arg)
{
    uint32_t gpio_num = (uint32_t) arg;
    xQueueSendFromISR(gpio_evt_queue, &gpio_num, NULL);
}

static void gpio_task_example(void* arg)
{
    uint32_t io_num;
    for(;;) {
        if(xQueueReceive(gpio_evt_queue, &io_num, portMAX_DELAY)) {
            printf("GPIO[%d] intr, val: %d\n", io_num, gpio_get_level(io_num));
        }
    }
}

void app_main()
{
    gpio_config_t io_conf;
    //disable interrupt
    io_conf.intr_type = GPIO_PIN_INTR_DISABLE;
    //set as output mode
    io_conf.mode = GPIO_MODE_OUTPUT;
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
    //disable pull-down mode
    io_conf.pull_down_en = 0;
    //disable pull-up mode
    io_conf.pull_up_en = 0;
    //configure GPIO with the given settings
    gpio_config(&io_conf);

    //interrupt of rising edge
    io_conf.intr_type = GPIO_PIN_INTR_POSEDGE;
    //bit mask of the pins, use GPIO4/5 here
    io_conf.pin_bit_mask = GPIO_INPUT_PIN_SEL;
    //set as input mode
    io_conf.mode = GPIO_MODE_INPUT;
    //enable pull-up mode
    io_conf.pull_up_en = 1;
    gpio_config(&io_conf);

    //change gpio intrrupt type for one pin
    gpio_set_intr_type(GPIO_INPUT_IO_0, GPIO_INTR_ANYEDGE);

    //create a queue to handle gpio event from isr
    gpio_evt_queue = xQueueCreate(10, sizeof(uint32_t));
    //start gpio task
    xTaskCreate(gpio_task_example, "gpio_task_example", 2048, NULL, 10, NULL);

    //install gpio isr service
    gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
    //hook isr handler for specific gpio pin
    gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);
    //hook isr handler for specific gpio pin
    gpio_isr_handler_add(GPIO_INPUT_IO_1, gpio_isr_handler, (void*) GPIO_INPUT_IO_1);

    //remove isr handler for gpio number.
    gpio_isr_handler_remove(GPIO_INPUT_IO_0);
    //hook isr handler for specific gpio pin again
    gpio_isr_handler_add(GPIO_INPUT_IO_0, gpio_isr_handler, (void*) GPIO_INPUT_IO_0);

    int cnt = 0;
    while(1) {
        printf("cnt: %d\n", cnt++);
        vTaskDelay(1000 / portTICK_RATE_MS);
        gpio_set_level(GPIO_OUTPUT_IO_0, cnt % 2);
        gpio_set_level(GPIO_OUTPUT_IO_1, cnt % 2);
    }
}


text:
package org.openo.nfvo.emsdriver.collector.alarm;
import java.util.ArrayList;
import java.util.List;

import org.openo.nfvo.emsdriver.commons.constant.Constant;
import org.openo.nfvo.emsdriver.commons.model.CollectVo;
import org.openo.nfvo.emsdriver.commons.model.EMSInfo;
import org.openo.nfvo.emsdriver.commons.utils.DriverThread;
import org.openo.nfvo.emsdriver.configmgr.ConfigurationInterface;

public class AlarmManager  extends DriverThread{

	private ConfigurationInterface configurationInterface;

	@Override
	public void dispose() {
		log.debug("AlarmManager is start");
		//get alarm config
		List<EMSInfo> emsInfos = configurationInterface.getAllEMSInfo();
		while(isRun() && emsInfos.size() == 0){
			emsInfos = configurationInterface.getAllEMSInfo();
			if(emsInfos.size() == 0){
				try {
					Thread.sleep(1000);
					log.debug("config is not load");
				} catch (InterruptedException e) {
				}
			}
		}
		List<CollectVo> collectVos = new ArrayList<CollectVo>();
		for(EMSInfo emsInfo : emsInfos){
			//alarm
			CollectVo CollectVo = emsInfo.getCollectVoByType(Constant.COLLECT_TYPE_ALARM);
			if(CollectVo != null){
				CollectVo.setEmsName(emsInfo.getName());
				collectVos.add(CollectVo);
			}
		}

		for(CollectVo collectVo : collectVos){
			AlarmTaskThread alarm = new AlarmTaskThread(collectVo);
			alarm.setName(collectVo.getIP()+collectVo.getPort());
			alarm.start();
		}

	}

	/**
	 * @return the configurationInterface
	 */
	public ConfigurationInterface getConfigurationInterface() {
		return configurationInterface;
	}

	/**
	 * @param configurationInterface the configurationInterface to set
	 */
	public void setConfigurationInterface(
			ConfigurationInterface configurationInterface) {
		this.configurationInterface = configurationInterface;
	}

}


text:
namespace gpu {

int GLManager::use_count_;
scoped_refptr<gfx::GLShareGroup>* GLManager::base_share_group_;
scoped_refptr<gfx::GLSurface>* GLManager::base_surface_;
scoped_refptr<gfx::GLContext>* GLManager::base_context_;

GLManager::Options::Options()
    : size(4, 4),
      share_group_manager(NULL),
      share_mailbox_manager(NULL),
      virtual_manager(NULL),
      bind_generates_resource(false),
      context_lost_allowed(false),
      image_manager(NULL),
      image_factory(NULL) {
}

GLManager::GLManager()
    : context_lost_allowed_(false) {
  SetupBaseContext();
}

GLManager::~GLManager() {
  --use_count_;
  if (!use_count_) {
    if (base_share_group_) {
      delete base_context_;
      base_context_ = NULL;
    }
    if (base_surface_) {
      delete base_surface_;
      base_surface_ = NULL;
    }
    if (base_context_) {
      delete base_context_;
      base_context_ = NULL;
    }
  }
}

void GLManager::Initialize(const GLManager::Options& options) {
  const int32 kCommandBufferSize = 1024 * 1024;
  const size_t kStartTransferBufferSize = 4 * 1024 * 1024;
  const size_t kMinTransferBufferSize = 1 * 256 * 1024;
  const size_t kMaxTransferBufferSize = 16 * 1024 * 1024;
  const bool kShareResources = true;

  context_lost_allowed_ = options.context_lost_allowed;

  gles2::MailboxManager* mailbox_manager = NULL;
  if (options.share_mailbox_manager) {
    mailbox_manager = options.share_mailbox_manager->mailbox_manager();
  } else if (options.share_group_manager) {
    mailbox_manager = options.share_group_manager->mailbox_manager();
  }

  gfx::GLShareGroup* share_group = NULL;
  if (options.share_group_manager) {
    share_group = options.share_group_manager->share_group();
  } else if (options.share_mailbox_manager) {
    share_group = options.share_mailbox_manager->share_group();
  }

  gles2::ContextGroup* context_group = NULL;
  gles2::ShareGroup* client_share_group = NULL;
  if (options.share_group_manager) {
    context_group = options.share_group_manager->decoder_->GetContextGroup();
    client_share_group =
      options.share_group_manager->gles2_implementation()->share_group();
  }

  gfx::GLContext* real_gl_context = NULL;
  if (options.virtual_manager) {
    real_gl_context = options.virtual_manager->context();
  }

  // From <EGL/egl.h>.
  const int32 EGL_ALPHA_SIZE = 0x3021;
  const int32 EGL_BLUE_SIZE = 0x3022;
  const int32 EGL_GREEN_SIZE = 0x3023;
  const int32 EGL_RED_SIZE = 0x3024;
  const int32 EGL_DEPTH_SIZE = 0x3025;
  const int32 EGL_NONE = 0x3038;

  mailbox_manager_ =
      mailbox_manager ? mailbox_manager : new gles2::MailboxManager;
  share_group_ =
      share_group ? share_group : new gfx::GLShareGroup;

  gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu);
  const char* allowed_extensions = "*";
  std::vector<int32> attribs;
  attribs.push_back(EGL_RED_SIZE);
  attribs.push_back(8);
  attribs.push_back(EGL_GREEN_SIZE);
  attribs.push_back(8);
  attribs.push_back(EGL_BLUE_SIZE);
  attribs.push_back(8);
  attribs.push_back(EGL_ALPHA_SIZE);
  attribs.push_back(8);
  attribs.push_back(EGL_DEPTH_SIZE);
  attribs.push_back(16);
  attribs.push_back(EGL_NONE);

  if (!context_group) {
    context_group = new gles2::ContextGroup(mailbox_manager_.get(),
                                            options.image_manager,
                                            NULL,
                                            options.bind_generates_resource);
  }

  decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group));

  command_buffer_.reset(new CommandBufferService(
      decoder_->GetContextGroup()->transfer_buffer_manager()));
  ASSERT_TRUE(command_buffer_->Initialize())
      << "could not create command buffer service";

  gpu_scheduler_.reset(new GpuScheduler(command_buffer_.get(),
                                        decoder_.get(),
                                        decoder_.get()));

  decoder_->set_engine(gpu_scheduler_.get());

  surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, options.size);
  ASSERT_TRUE(surface_.get() != NULL) << "could not create offscreen surface";

  if (real_gl_context) {
    context_ = scoped_refptr<gfx::GLContext>(new gpu::GLContextVirtual(
        share_group_.get(), real_gl_context, decoder_->AsWeakPtr()));
    ASSERT_TRUE(context_->Initialize(
        surface_.get(), gfx::PreferIntegratedGpu));
  } else {
    if (base_context_) {
      context_ = scoped_refptr<gfx::GLContext>(new gpu::GLContextVirtual(
          share_group_.get(), base_context_->get(), decoder_->AsWeakPtr()));
      ASSERT_TRUE(context_->Initialize(
          surface_.get(), gfx::PreferIntegratedGpu));
    } else {
      context_ = gfx::GLContext::CreateGLContext(share_group_.get(),
                                                 surface_.get(),
                                                 gpu_preference);
    }
  }
  ASSERT_TRUE(context_.get() != NULL) << "could not create GL context";

  ASSERT_TRUE(context_->MakeCurrent(surface_.get()));

  ASSERT_TRUE(decoder_->Initialize(
      surface_.get(),
      context_.get(),
      true,
      options.size,
      ::gpu::gles2::DisallowedFeatures(),
      allowed_extensions,
      attribs)) << "could not initialize decoder";

  command_buffer_->SetPutOffsetChangeCallback(
      base::Bind(&GLManager::PumpCommands, base::Unretained(this)));
  command_buffer_->SetGetBufferChangeCallback(
      base::Bind(&GLManager::GetBufferChanged, base::Unretained(this)));

  // Create the GLES2 helper, which writes the command buffer protocol.
  gles2_helper_.reset(new gles2::GLES2CmdHelper(command_buffer_.get()));
  ASSERT_TRUE(gles2_helper_->Initialize(kCommandBufferSize));

  // Create a transfer buffer.
  transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));

  // Create the object exposing the OpenGL API.
  gles2_implementation_.reset(new gles2::GLES2Implementation(
      gles2_helper_.get(),
      client_share_group,
      transfer_buffer_.get(),
      kShareResources,
      options.bind_generates_resource,
      options.image_factory));

  ASSERT_TRUE(gles2_implementation_->Initialize(
      kStartTransferBufferSize,
      kMinTransferBufferSize,
      kMaxTransferBufferSize)) << "Could not init GLES2Implementation";

  MakeCurrent();
}

void GLManager::SetupBaseContext() {
  if (use_count_) {
    #if defined(OS_ANDROID)
      base_share_group_ = new scoped_refptr<gfx::GLShareGroup>(
          new gfx::GLShareGroup);
      gfx::Size size(4, 4);
      base_surface_ = new scoped_refptr<gfx::GLSurface>(
          gfx::GLSurface::CreateOffscreenGLSurface(false, size));
      gfx::GpuPreference gpu_preference(gfx::PreferDiscreteGpu);
      base_context_ = new scoped_refptr<gfx::GLContext>(
          gfx::GLContext::CreateGLContext(base_share_group_->get(),
                                          base_surface_->get(),
                                          gpu_preference));
    #endif
  }
  ++use_count_;
}

void GLManager::MakeCurrent() {
  ::gles2::SetGLContext(gles2_implementation_.get());
}

void GLManager::SetSurface(gfx::GLSurface* surface) {
  decoder_->SetSurface(surface);
}

void GLManager::Destroy() {
  if (gles2_implementation_.get()) {
    MakeCurrent();
    EXPECT_TRUE(glGetError() == GL_NONE);
    gles2_implementation_->Flush();
    gles2_implementation_.reset();
  }
  transfer_buffer_.reset();
  gles2_helper_.reset();
  command_buffer_.reset();
  if (decoder_.get()) {
    decoder_->MakeCurrent();
    decoder_->Destroy(true);
  }
}

void GLManager::PumpCommands() {
  decoder_->MakeCurrent();
  gpu_scheduler_->PutChanged();
  ::gpu::CommandBuffer::State state = command_buffer_->GetState();
  if (!context_lost_allowed_) {
    ASSERT_EQ(::gpu::error::kNoError, state.error);
  }
}

bool GLManager::GetBufferChanged(int32 transfer_buffer_id) {
  return gpu_scheduler_->SetGetBuffer(transfer_buffer_id);
}

}  // namespace gpu


text:
from django.db import models

class Author(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)

    def __str__(self):
        return '%s %s' % (self.first_name, self.last_name)

class Article(models.Model):
    author = models.ForeignKey(Author, on_delete=models.CASCADE)
    headline = models.CharField(max_length=100)

    def __str__(self):
        return self.headline

class Entry(models.Model):
    title = models.CharField(max_length=250)
    body = models.TextField()
    pub_date = models.DateField()
    enable_comments = models.BooleanField()

    def __str__(self):
        return self.title

class Book(models.Model):
    dewey_decimal = models.DecimalField(primary_key=True, decimal_places=2, max_digits=5)


text:
package java.lang.reflect;

import sun.reflect.CallerSensitive;
import sun.reflect.ConstructorAccessor;
import sun.reflect.Reflection;
import sun.reflect.annotation.TypeAnnotation;
import sun.reflect.annotation.TypeAnnotationParser;
import sun.reflect.generics.repository.ConstructorRepository;
import sun.reflect.generics.factory.CoreReflectionFactory;
import sun.reflect.generics.factory.GenericsFactory;
import sun.reflect.generics.scope.ConstructorScope;
import java.lang.annotation.Annotation;
import java.lang.annotation.AnnotationFormatError;

/**
 * {@code Constructor} provides information about, and access to, a single
 * constructor for a class.
 *
 *
{@code Constructor} permits widening conversions to occur when matching the
 * actual parameters to newInstance() with the underlying
 * constructor's formal parameters, but throws an
 * {@code IllegalArgumentException} if a narrowing conversion would occur.
 *
 * @param <T> the class in which the constructor is declared
 *
 * @see Member
 * @see java.lang.Class
 * @see java.lang.Class#getConstructors()
 * @see java.lang.Class#getConstructor(Class[])
 * @see java.lang.Class#getDeclaredConstructors()
 *
 * @author      Kenneth Russell
 * @author      Nakul Saraiya
 */
public final class Constructor<T> extends Executable {
    private Class<T>            clazz;
    private int                 slot;
    private Class<?>[]          parameterTypes;
    private Class<?>[]          exceptionTypes;
    private int                 modifiers;
    // Generics and annotations support
    private transient String    signature;
    // generic info repository; lazily initialized
    private transient ConstructorRepository genericInfo;
    private byte[]              annotations;
    private byte[]              parameterAnnotations;

    // Generics infrastructure
    // Accessor for factory
    private GenericsFactory getFactory() {
        // create scope and factory
        return CoreReflectionFactory.make(this, ConstructorScope.make(this));
    }

    // Accessor for generic info repository
    @Override
    ConstructorRepository getGenericInfo() {
        // lazily initialize repository if necessary
        if (genericInfo == null) {
            // create and cache generic info repository
            genericInfo =
                ConstructorRepository.make(getSignature(),
                                           getFactory());
        }
        return genericInfo; //return cached repository
    }

    private volatile ConstructorAccessor constructorAccessor;
    // For sharing of ConstructorAccessors. This branching structure
    // is currently only two levels deep (i.e., one root Constructor
    // and potentially many Constructor objects pointing to it.)
    //
    // If this branching structure would ever contain cycles, deadlocks can
    // occur in annotation code.
    private Constructor<T>      root;

    /**
     * Used by Excecutable for annotation sharing.
     */
    @Override
    Executable getRoot() {
        return root;
    }

    /**
     * Package-private constructor used by ReflectAccess to enable
     * instantiation of these objects in Java code from the java.lang
     * package via sun.reflect.LangReflectAccess.
     */
    Constructor(Class<T> declaringClass,
                Class<?>[] parameterTypes,
                Class<?>[] checkedExceptions,
                int modifiers,
                int slot,
                String signature,
                byte[] annotations,
                byte[] parameterAnnotations) {
        this.clazz = declaringClass;
        this.parameterTypes = parameterTypes;
        this.exceptionTypes = checkedExceptions;
        this.modifiers = modifiers;
        this.slot = slot;
        this.signature = signature;
        this.annotations = annotations;
        this.parameterAnnotations = parameterAnnotations;
    }

    /**
     * Package-private routine (exposed to java.lang.Class via
     * ReflectAccess) which returns a copy of this Constructor. The copy's
     * "root" field points to this Constructor.
     */
    Constructor<T> copy() {
        // This routine enables sharing of ConstructorAccessor objects
        // among Constructor objects which refer to the same underlying
        // method in the VM. (All of this contortion is only necessary
        // because of the "accessibility" bit in AccessibleObject,
        // which implicitly requires that new java.lang.reflect
        // objects be fabricated for each reflective call on Class
        // objects.)
        if (this.root != null)
            throw new IllegalArgumentException("Can not copy a non-root Constructor");

        Constructor<T> res = new Constructor<>(clazz,
                                               parameterTypes,
                                               exceptionTypes, modifiers, slot,
                                               signature,
                                               annotations,
                                               parameterAnnotations);
        res.root = this;
        // Might as well eagerly propagate this if already present
        res.constructorAccessor = constructorAccessor;
        return res;
    }

    @Override
    boolean hasGenericInformation() {
        return (getSignature() != null);
    }

    @Override
    byte[] getAnnotationBytes() {
        return annotations;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Class<T> getDeclaringClass() {
        return clazz;
    }

    /**
     * Returns the name of this constructor, as a string.  This is
     * the binary name of the constructor's declaring class.
     */
    @Override
    public String getName() {
        return getDeclaringClass().getName();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int getModifiers() {
        return modifiers;
    }

    /**
     * {@inheritDoc}
     * @throws GenericSignatureFormatError {@inheritDoc}
     * @since 1.5
     */
    @Override
    @SuppressWarnings({"rawtypes", "unchecked"})
    public TypeVariable<Constructor<T>>[] getTypeParameters() {
      if (getSignature() != null) {
        return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
      } else
          return (TypeVariable<Constructor<T>>[])new TypeVariable[0];
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Class<?>[] getParameterTypes() {
        return parameterTypes.clone();
    }

    /**
     * {@inheritDoc}
     * @since 1.8
     */
    public int getParameterCount() { return parameterTypes.length; }

    /**
     * {@inheritDoc}
     * @throws GenericSignatureFormatError {@inheritDoc}
     * @throws TypeNotPresentException {@inheritDoc}
     * @throws MalformedParameterizedTypeException {@inheritDoc}
     * @since 1.5
     */
    @Override
    public Type[] getGenericParameterTypes() {
        return super.getGenericParameterTypes();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Class<?>[] getExceptionTypes() {
        return exceptionTypes.clone();
    }

    /**
     * {@inheritDoc}
     * @throws GenericSignatureFormatError {@inheritDoc}
     * @throws TypeNotPresentException {@inheritDoc}
     * @throws MalformedParameterizedTypeException {@inheritDoc}
     * @since 1.5
     */
    @Override
    public Type[] getGenericExceptionTypes() {
        return super.getGenericExceptionTypes();
    }

    /**
     * Compares this {@code Constructor} against the specified object.
     * Returns true if the objects are the same.  Two {@code Constructor} objects are
     * the same if they were declared by the same class and have the
     * same formal parameter types.
     */
    public boolean equals(Object obj) {
        if (obj != null && obj instanceof Constructor) {
            Constructor<?> other = (Constructor<?>)obj;
            if (getDeclaringClass() == other.getDeclaringClass()) {
                return equalParamTypes(parameterTypes, other.parameterTypes);
            }
        }
        return false;
    }

    /**
     * Returns a hashcode for this {@code Constructor}. The hashcode is
     * the same as the hashcode for the underlying constructor's
     * declaring class name.
     */
    public int hashCode() {
        return getDeclaringClass().getName().hashCode();
    }

    /**
     * Returns a string describing this {@code Constructor}.  The string is
     * formatted as the constructor access modifiers, if any,
     * followed by the fully-qualified name of the declaring class,
     * followed by a parenthesized, comma-separated list of the
     * constructor's formal parameter types.  For example:
     *

     *    public java.util.Hashtable(int,float)
     *

     *
     *
The only possible modifiers for constructors are the access
     * modifiers {@code public}, {@code protected} or
     * {@code private}.  Only one of these may appear, or none if the
     * constructor has default (package) access.
     *
     * @return a string describing this {@code Constructor}
     * @jls 8.8.3. Constructor Modifiers
     */
    public String toString() {
        return sharedToString(Modifier.constructorModifiers(),
                              false,
                              parameterTypes,
                              exceptionTypes);
    }

    @Override
    void specificToStringHeader(StringBuilder sb) {
        sb.append(getDeclaringClass().getTypeName());
    }

    /**
     * Returns a string describing this {@code Constructor},
     * including type parameters.  The string is formatted as the
     * constructor access modifiers, if any, followed by an
     * angle-bracketed comma separated list of the constructor's type
     * parameters, if any, followed by the fully-qualified name of the
     * declaring class, followed by a parenthesized, comma-separated
     * list of the constructor's generic formal parameter types.
     *
     * If this constructor was declared to take a variable number of
     * arguments, instead of denoting the last parameter as
     * "<tt>Type[]</tt>", it is denoted as
     * "<tt>Type...</tt>".
     *
     * A space is used to separate access modifiers from one another
     * and from the type parameters or return type.  If there are no
     * type parameters, the type parameter list is elided; if the type
     * parameter list is present, a space separates the list from the
     * class name.  If the constructor is declared to throw
     * exceptions, the parameter list is followed by a space, followed
     * by the word "{@code throws}" followed by a
     * comma-separated list of the thrown exception types.
     *
     *
The only possible modifiers for constructors are the access
     * modifiers {@code public}, {@code protected} or
     * {@code private}.  Only one of these may appear, or none if the
     * constructor has default (package) access.
     *
     * @return a string describing this {@code Constructor},
     * include type parameters
     *
     * @since 1.5
     * @jls 8.8.3. Constructor Modifiers
     */
    @Override
    public String toGenericString() {
        return sharedToGenericString(Modifier.constructorModifiers(), false);
    }

    @Override
    void specificToGenericStringHeader(StringBuilder sb) {
        specificToStringHeader(sb);
    }

    /**
     * Uses the constructor represented by this {@code Constructor} object to
     * create and initialize a new instance of the constructor's
     * declaring class, with the specified initialization parameters.
     * Individual parameters are automatically unwrapped to match
     * primitive formal parameters, and both primitive and reference
     * parameters are subject to method invocation conversions as necessary.
     *
     *
If the number of formal parameters required by the underlying constructor
     * is 0, the supplied {@code initargs} array may be of length 0 or null.
     *
     *
If the constructor's declaring class is an inner class in a
     * non-static context, the first argument to the constructor needs
     * to be the enclosing instance; see section 15.9.3 of
     * The Java™ Language Specification.
     *
     *
If the required access and argument checks succeed and the
     * instantiation will proceed, the constructor's declaring class
     * is initialized if it has not already been initialized.
     *
     *
If the constructor completes normally, returns the newly
     * created and initialized instance.
     *
     * @param initargs array of objects to be passed as arguments to
     * the constructor call; values of primitive types are wrapped in
     * a wrapper object of the appropriate type (e.g. a {@code float}
     * in a {@link java.lang.Float Float})
     *
     * @return a new object created by calling the constructor
     * this object represents
     *
     * @exception IllegalAccessException    if this {@code Constructor} object
     *              is enforcing Java language access control and the underlying
     *              constructor is inaccessible.
     * @exception IllegalArgumentException  if the number of actual
     *              and formal parameters differ; if an unwrapping
     *              conversion for primitive arguments fails; or if,
     *              after possible unwrapping, a parameter value
     *              cannot be converted to the corresponding formal
     *              parameter type by a method invocation conversion; if
     *              this constructor pertains to an enum type.
     * @exception InstantiationException    if the class that declares the
     *              underlying constructor represents an abstract class.
     * @exception InvocationTargetException if the underlying constructor
     *              throws an exception.
     * @exception ExceptionInInitializerError if the initialization provoked
     *              by this method fails.
     */
    @CallerSensitive
    public T newInstance(Object ... initargs)
        throws InstantiationException, IllegalAccessException,
               IllegalArgumentException, InvocationTargetException
    {
        if (!override) {
            if (!Reflection.quickCheckMemberAccess(clazz, modifiers)) {
                Class<?> caller = Reflection.getCallerClass();
                checkAccess(caller, clazz, null, modifiers);
            }
        }
        if ((clazz.getModifiers() & Modifier.ENUM) != 0)
            throw new IllegalArgumentException("Cannot reflectively create enum objects");
        ConstructorAccessor ca = constructorAccessor;   // read volatile
        if (ca == null) {
            ca = acquireConstructorAccessor();
        }
        @SuppressWarnings("unchecked")
        T inst = (T) ca.newInstance(initargs);
        return inst;
    }

    /**
     * {@inheritDoc}
     * @since 1.5
     */
    @Override
    public boolean isVarArgs() {
        return super.isVarArgs();
    }

    /**
     * {@inheritDoc}
     * @jls 13.1 The Form of a Binary
     * @since 1.5
     */
    @Override
    public boolean isSynthetic() {
        return super.isSynthetic();
    }

    // NOTE that there is no synchronization used here. It is correct
    // (though not efficient) to generate more than one
    // ConstructorAccessor for a given Constructor. However, avoiding
    // synchronization will probably make the implementation more
    // scalable.
    private ConstructorAccessor acquireConstructorAccessor() {
        // First check to see if one has been created yet, and take it
        // if so.
        ConstructorAccessor tmp = null;
        if (root != null) tmp = root.getConstructorAccessor();
        if (tmp != null) {
            constructorAccessor = tmp;
        } else {
            // Otherwise fabricate one and propagate it up to the root
            tmp = reflectionFactory.newConstructorAccessor(this);
            setConstructorAccessor(tmp);
        }

        return tmp;
    }

    // Returns ConstructorAccessor for this Constructor object, not
    // looking up the chain to the root
    ConstructorAccessor getConstructorAccessor() {
        return constructorAccessor;
    }

    // Sets the ConstructorAccessor for this Constructor object and
    // (recursively) its root
    void setConstructorAccessor(ConstructorAccessor accessor) {
        constructorAccessor = accessor;
        // Propagate up
        if (root != null) {
            root.setConstructorAccessor(accessor);
        }
    }

    int getSlot() {
        return slot;
    }

    String getSignature() {
        return signature;
    }

    byte[] getRawAnnotations() {
        return annotations;
    }

    byte[] getRawParameterAnnotations() {
        return parameterAnnotations;
    }

    /**
     * {@inheritDoc}
     * @throws NullPointerException  {@inheritDoc}
     * @since 1.5
     */
    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
        return super.getAnnotation(annotationClass);
    }

    /**
     * {@inheritDoc}
     * @since 1.5
     */
    public Annotation[] getDeclaredAnnotations()  {
        return super.getDeclaredAnnotations();
    }

    /**
     * {@inheritDoc}
     * @since 1.5
     */
    @Override
    public Annotation[][] getParameterAnnotations() {
        return sharedGetParameterAnnotations(parameterTypes, parameterAnnotations);
    }

    @Override
    void handleParameterNumberMismatch(int resultLength, int numParameters) {
        Class<?> declaringClass = getDeclaringClass();
        if (declaringClass.isEnum() ||
            declaringClass.isAnonymousClass() ||
            declaringClass.isLocalClass() )
            return ; // Can't do reliable parameter counting
        else {
            if (!declaringClass.isMemberClass() || // top-level
                // Check for the enclosing instance parameter for
                // non-static member classes
                (declaringClass.isMemberClass() &&
                 ((declaringClass.getModifiers() & Modifier.STATIC) == 0)  &&
                 resultLength + 1 != numParameters) ) {
                throw new AnnotationFormatError(
                          "Parameter annotations don't match number of parameters");
            }
        }
    }

    /**
     * {@inheritDoc}
     * @since 1.8
     */
    @Override
    public AnnotatedType getAnnotatedReturnType() {
        return getAnnotatedReturnType0(getDeclaringClass());
    }

    /**
     * {@inheritDoc}
     * @since 1.8
     */
    @Override
    public AnnotatedType getAnnotatedReceiverType() {
        if (getDeclaringClass().getEnclosingClass() == null)
            return super.getAnnotatedReceiverType();

        return TypeAnnotationParser.buildAnnotatedType(getTypeAnnotationBytes0(),
                sun.misc.SharedSecrets.getJavaLangAccess().
                        getConstantPool(getDeclaringClass()),
                this,
                getDeclaringClass(),
                getDeclaringClass().getEnclosingClass(),
                TypeAnnotation.TypeAnnotationTarget.METHOD_RECEIVER);
    }
}


text:
/** @jsx h */

import h from '../../../helpers/h'

export default function(change) {
  change.insertText('a')
}

export const input = (
  <value>
    <document>
      <paragraph>
        <cursor />word
      </paragraph>
    </document>
  </value>
)

export const output = (
  <value>
    <document>
      <paragraph>
        a<cursor />word
      </paragraph>
    </document>
  </value>
)


text:
package org.apache.flink.runtime.jobmaster.utils;

import org.apache.flink.api.common.JobID;
import org.apache.flink.api.java.tuple.Tuple4;
import org.apache.flink.api.java.tuple.Tuple5;
import org.apache.flink.api.java.tuple.Tuple6;
import org.apache.flink.queryablestate.KvStateID;
import org.apache.flink.runtime.checkpoint.CheckpointMetrics;
import org.apache.flink.runtime.checkpoint.TaskStateSnapshot;
import org.apache.flink.runtime.clusterframework.types.AllocationID;
import org.apache.flink.runtime.clusterframework.types.ResourceID;
import org.apache.flink.runtime.concurrent.FutureUtils;
import org.apache.flink.runtime.execution.ExecutionState;
import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
import org.apache.flink.runtime.io.network.partition.ResultPartitionID;
import org.apache.flink.runtime.jobgraph.IntermediateDataSetID;
import org.apache.flink.runtime.jobgraph.JobVertexID;
import org.apache.flink.runtime.jobgraph.OperatorID;
import org.apache.flink.runtime.jobmaster.JMTMRegistrationSuccess;
import org.apache.flink.runtime.jobmaster.JobMasterId;
import org.apache.flink.runtime.jobmaster.SerializedInputSplit;
import org.apache.flink.runtime.messages.Acknowledge;
import org.apache.flink.runtime.messages.checkpoint.DeclineCheckpoint;
import org.apache.flink.runtime.messages.webmonitor.JobDetails;
import org.apache.flink.runtime.operators.coordination.CoordinationRequest;
import org.apache.flink.runtime.operators.coordination.CoordinationResponse;
import org.apache.flink.runtime.operators.coordination.OperatorEvent;
import org.apache.flink.runtime.query.KvStateLocation;
import org.apache.flink.runtime.query.UnknownKvStateLocation;
import org.apache.flink.runtime.registration.RegistrationResponse;
import org.apache.flink.runtime.resourcemanager.ResourceManagerId;
import org.apache.flink.runtime.scheduler.ExecutionGraphInfo;
import org.apache.flink.runtime.slots.ResourceRequirement;
import org.apache.flink.runtime.state.KeyGroupRange;
import org.apache.flink.runtime.taskexecutor.TaskExecutorToJobManagerHeartbeatPayload;
import org.apache.flink.runtime.taskexecutor.slot.SlotOffer;
import org.apache.flink.runtime.taskmanager.TaskExecutionState;
import org.apache.flink.runtime.taskmanager.UnresolvedTaskManagerLocation;
import org.apache.flink.util.SerializedValue;
import org.apache.flink.util.function.TriConsumer;
import org.apache.flink.util.function.TriFunction;

import java.net.InetSocketAddress;
import java.util.Collection;
import java.util.Collections;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;

/** Builder for {@link TestingJobMasterGateway}. */
public class TestingJobMasterGatewayBuilder {
    private static final ResourceID RESOURCE_MANAGER_ID = ResourceID.generate();
    private static final JobMasterId JOB_MASTER_ID = JobMasterId.generate();

    private String address = "akka.tcp://flink@localhost:6130/user/jobmanager";
    private String hostname = "localhost";
    private Supplier<CompletableFuture<Acknowledge>> cancelFunction =
            () -> CompletableFuture.completedFuture(Acknowledge.get());
    private Function<TaskExecutionState, CompletableFuture<Acknowledge>>
            updateTaskExecutionStateFunction =
                    ignored -> CompletableFuture.completedFuture(Acknowledge.get());
    private BiFunction<JobVertexID, ExecutionAttemptID, CompletableFuture<SerializedInputSplit>>
            requestNextInputSplitFunction =
                    (ignoredA, ignoredB) ->
                            CompletableFuture.completedFuture(new SerializedInputSplit(null));
    private BiFunction<IntermediateDataSetID, ResultPartitionID, CompletableFuture<ExecutionState>>
            requestPartitionStateFunction =
                    (ignoredA, ignoredB) ->
                            CompletableFuture.completedFuture(ExecutionState.RUNNING);
    private Function<ResultPartitionID, CompletableFuture<Acknowledge>>
            notifyPartitionDataAvailableFunction =
                    ignored -> CompletableFuture.completedFuture(Acknowledge.get());
    private Function<ResourceID, CompletableFuture<Acknowledge>> disconnectTaskManagerFunction =
            ignored -> CompletableFuture.completedFuture(Acknowledge.get());
    private Consumer<ResourceManagerId> disconnectResourceManagerConsumer = ignored -> {};
    private BiFunction<ResourceID, Collection<SlotOffer>, CompletableFuture<Collection<SlotOffer>>>
            offerSlotsFunction =
                    (ignoredA, ignoredB) ->
                            CompletableFuture.completedFuture(Collections.emptyList());
    private TriConsumer<ResourceID, AllocationID, Throwable> failSlotConsumer =
            (ignoredA, ignoredB, ignoredC) -> {};
    private TriFunction<
                    String,
                    UnresolvedTaskManagerLocation,
                    JobID,
                    CompletableFuture<RegistrationResponse>>
            registerTaskManagerFunction =
                    (ignoredA, ignoredB, ignoredC) ->
                            CompletableFuture.completedFuture(
                                    new JMTMRegistrationSuccess(RESOURCE_MANAGER_ID));
    private BiConsumer<ResourceID, TaskExecutorToJobManagerHeartbeatPayload>
            taskManagerHeartbeatConsumer = (ignoredA, ignoredB) -> {};
    private Consumer<ResourceID> resourceManagerHeartbeatConsumer = ignored -> {};
    private Supplier<CompletableFuture<JobDetails>> requestJobDetailsSupplier =
            () -> FutureUtils.completedExceptionally(new UnsupportedOperationException());
    private Supplier<CompletableFuture<ExecutionGraphInfo>> requestJobSupplier =
            () -> FutureUtils.completedExceptionally(new UnsupportedOperationException());
    private BiFunction<String, Boolean, CompletableFuture<String>> triggerSavepointFunction =
            (targetDirectory, ignoredB) ->
                    CompletableFuture.completedFuture(
                            targetDirectory != null
                                    ? targetDirectory
                                    : UUID.randomUUID().toString());
    private BiFunction<String, Boolean, CompletableFuture<String>> stopWithSavepointFunction =
            (targetDirectory, ignoredB) ->
                    CompletableFuture.completedFuture(
                            targetDirectory != null
                                    ? targetDirectory
                                    : UUID.randomUUID().toString());
    private BiConsumer<AllocationID, Throwable> notifyAllocationFailureConsumer =
            (ignoredA, ignoredB) -> {};
    private Consumer<Tuple5<JobID, ExecutionAttemptID, Long, CheckpointMetrics, TaskStateSnapshot>>
            acknowledgeCheckpointConsumer = ignored -> {};
    private Consumer<DeclineCheckpoint> declineCheckpointConsumer = ignored -> {};
    private Supplier<JobMasterId> fencingTokenSupplier = () -> JOB_MASTER_ID;
    private BiFunction<JobID, String, CompletableFuture<KvStateLocation>>
            requestKvStateLocationFunction =
                    (ignoredA, registrationName) ->
                            FutureUtils.completedExceptionally(
                                    new UnknownKvStateLocation(registrationName));
    private Function<
                    Tuple6<JobID, JobVertexID, KeyGroupRange, String, KvStateID, InetSocketAddress>,
                    CompletableFuture<Acknowledge>>
            notifyKvStateRegisteredFunction =
                    ignored -> CompletableFuture.completedFuture(Acknowledge.get());
    private Function<
                    Tuple4<JobID, JobVertexID, KeyGroupRange, String>,
                    CompletableFuture<Acknowledge>>
            notifyKvStateUnregisteredFunction =
                    ignored -> CompletableFuture.completedFuture(Acknowledge.get());
    private TriFunction<String, Object, byte[], CompletableFuture<Object>> updateAggregateFunction =
            (a, b, c) -> CompletableFuture.completedFuture(new Object());
    private TriFunction<
                    ExecutionAttemptID,
                    OperatorID,
                    SerializedValue<OperatorEvent>,
                    CompletableFuture<Acknowledge>>
            operatorEventSender = (a, b, c) -> CompletableFuture.completedFuture(Acknowledge.get());
    private BiFunction<
                    OperatorID,
                    SerializedValue<CoordinationRequest>,
                    CompletableFuture<CoordinationResponse>>
            deliverCoordinationRequestFunction =
                    (a, b) ->
                            FutureUtils.completedExceptionally(new UnsupportedOperationException());
    private Consumer<Collection<ResourceRequirement>> notifyNotEnoughResourcesConsumer =
            ignored -> {};

    public TestingJobMasterGatewayBuilder setAddress(String address) {
        this.address = address;
        return this;
    }

    public TestingJobMasterGatewayBuilder setHostname(String hostname) {
        this.hostname = hostname;
        return this;
    }

    public TestingJobMasterGatewayBuilder setCancelFunction(
            Supplier<CompletableFuture<Acknowledge>> cancelFunction) {
        this.cancelFunction = cancelFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setUpdateTaskExecutionStateFunction(
            Function<TaskExecutionState, CompletableFuture<Acknowledge>>
                    updateTaskExecutionStateFunction) {
        this.updateTaskExecutionStateFunction = updateTaskExecutionStateFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRequestNextInputSplitFunction(
            BiFunction<JobVertexID, ExecutionAttemptID, CompletableFuture<SerializedInputSplit>>
                    requestNextInputSplitFunction) {
        this.requestNextInputSplitFunction = requestNextInputSplitFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRequestPartitionStateFunction(
            BiFunction<IntermediateDataSetID, ResultPartitionID, CompletableFuture<ExecutionState>>
                    requestPartitionStateFunction) {
        this.requestPartitionStateFunction = requestPartitionStateFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setNotifyPartitionDataAvailableFunction(
            Function<ResultPartitionID, CompletableFuture<Acknowledge>>
                    notifyPartitionDataAvailableFunction) {
        this.notifyPartitionDataAvailableFunction = notifyPartitionDataAvailableFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setDisconnectTaskManagerFunction(
            Function<ResourceID, CompletableFuture<Acknowledge>> disconnectTaskManagerFunction) {
        this.disconnectTaskManagerFunction = disconnectTaskManagerFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setDisconnectResourceManagerConsumer(
            Consumer<ResourceManagerId> disconnectResourceManagerConsumer) {
        this.disconnectResourceManagerConsumer = disconnectResourceManagerConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setOfferSlotsFunction(
            BiFunction<ResourceID, Collection<SlotOffer>, CompletableFuture<Collection<SlotOffer>>>
                    offerSlotsFunction) {
        this.offerSlotsFunction = offerSlotsFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setFailSlotConsumer(
            TriConsumer<ResourceID, AllocationID, Throwable> failSlotConsumer) {
        this.failSlotConsumer = failSlotConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRegisterTaskManagerFunction(
            TriFunction<
                            String,
                            UnresolvedTaskManagerLocation,
                            JobID,
                            CompletableFuture<RegistrationResponse>>
                    registerTaskManagerFunction) {
        this.registerTaskManagerFunction = registerTaskManagerFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setTaskManagerHeartbeatConsumer(
            BiConsumer<ResourceID, TaskExecutorToJobManagerHeartbeatPayload>
                    taskManagerHeartbeatConsumer) {
        this.taskManagerHeartbeatConsumer = taskManagerHeartbeatConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setResourceManagerHeartbeatConsumer(
            Consumer<ResourceID> resourceManagerHeartbeatConsumer) {
        this.resourceManagerHeartbeatConsumer = resourceManagerHeartbeatConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRequestJobDetailsSupplier(
            Supplier<CompletableFuture<JobDetails>> requestJobDetailsSupplier) {
        this.requestJobDetailsSupplier = requestJobDetailsSupplier;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRequestJobSupplier(
            Supplier<CompletableFuture<ExecutionGraphInfo>> requestJobSupplier) {
        this.requestJobSupplier = requestJobSupplier;
        return this;
    }

    public TestingJobMasterGatewayBuilder setTriggerSavepointFunction(
            BiFunction<String, Boolean, CompletableFuture<String>> triggerSavepointFunction) {
        this.triggerSavepointFunction = triggerSavepointFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setStopWithSavepointSupplier(
            BiFunction<String, Boolean, CompletableFuture<String>> stopWithSavepointFunction) {
        this.stopWithSavepointFunction = stopWithSavepointFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setNotifyAllocationFailureConsumer(
            BiConsumer<AllocationID, Throwable> notifyAllocationFailureConsumer) {
        this.notifyAllocationFailureConsumer = notifyAllocationFailureConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setNotifyNotEnoughResourcesConsumer(
            Consumer<Collection<ResourceRequirement>> notifyNotEnoughResourcesConsumer) {
        this.notifyNotEnoughResourcesConsumer = notifyNotEnoughResourcesConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setAcknowledgeCheckpointConsumer(
            Consumer<Tuple5<JobID, ExecutionAttemptID, Long, CheckpointMetrics, TaskStateSnapshot>>
                    acknowledgeCheckpointConsumer) {
        this.acknowledgeCheckpointConsumer = acknowledgeCheckpointConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setDeclineCheckpointConsumer(
            Consumer<DeclineCheckpoint> declineCheckpointConsumer) {
        this.declineCheckpointConsumer = declineCheckpointConsumer;
        return this;
    }

    public TestingJobMasterGatewayBuilder setFencingTokenSupplier(
            Supplier<JobMasterId> fencingTokenSupplier) {
        this.fencingTokenSupplier = fencingTokenSupplier;
        return this;
    }

    public TestingJobMasterGatewayBuilder setRequestKvStateLocationFunction(
            BiFunction<JobID, String, CompletableFuture<KvStateLocation>>
                    requestKvStateLocationFunction) {
        this.requestKvStateLocationFunction = requestKvStateLocationFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setNotifyKvStateRegisteredFunction(
            Function<
                            Tuple6<
                                    JobID,
                                    JobVertexID,
                                    KeyGroupRange,
                                    String,
                                    KvStateID,
                                    InetSocketAddress>,
                            CompletableFuture<Acknowledge>>
                    notifyKvStateRegisteredFunction) {
        this.notifyKvStateRegisteredFunction = notifyKvStateRegisteredFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setNotifyKvStateUnregisteredFunction(
            Function<
                            Tuple4<JobID, JobVertexID, KeyGroupRange, String>,
                            CompletableFuture<Acknowledge>>
                    notifyKvStateUnregisteredFunction) {
        this.notifyKvStateUnregisteredFunction = notifyKvStateUnregisteredFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setUpdateAggregateFunction(
            TriFunction<String, Object, byte[], CompletableFuture<Object>>
                    updateAggregateFunction) {
        this.updateAggregateFunction = updateAggregateFunction;
        return this;
    }

    public TestingJobMasterGatewayBuilder setOperatorEventSender(
            TriFunction<
                            ExecutionAttemptID,
                            OperatorID,
                            SerializedValue<OperatorEvent>,
                            CompletableFuture<Acknowledge>>
                    operatorEventSender) {
        this.operatorEventSender = operatorEventSender;
        return this;
    }

    public TestingJobMasterGatewayBuilder setDeliverCoordinationRequestFunction(
            BiFunction<
                            OperatorID,
                            SerializedValue<CoordinationRequest>,
                            CompletableFuture<CoordinationResponse>>
                    deliverCoordinationRequestFunction) {
        this.deliverCoordinationRequestFunction = deliverCoordinationRequestFunction;
        return this;
    }

    public TestingJobMasterGateway build() {
        return new TestingJobMasterGateway(
                address,
                hostname,
                cancelFunction,
                updateTaskExecutionStateFunction,
                requestNextInputSplitFunction,
                requestPartitionStateFunction,
                notifyPartitionDataAvailableFunction,
                disconnectTaskManagerFunction,
                disconnectResourceManagerConsumer,
                offerSlotsFunction,
                failSlotConsumer,
                registerTaskManagerFunction,
                taskManagerHeartbeatConsumer,
                resourceManagerHeartbeatConsumer,
                requestJobDetailsSupplier,
                requestJobSupplier,
                triggerSavepointFunction,
                stopWithSavepointFunction,
                notifyAllocationFailureConsumer,
                acknowledgeCheckpointConsumer,
                declineCheckpointConsumer,
                fencingTokenSupplier,
                requestKvStateLocationFunction,
                notifyKvStateRegisteredFunction,
                notifyKvStateUnregisteredFunction,
                updateAggregateFunction,
                operatorEventSender,
                deliverCoordinationRequestFunction,
                notifyNotEnoughResourcesConsumer);
    }
}


text:
package io.github.shark_app.shark;

import android.Manifest;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {
    public static final String PREFS_NAME = "SHARK_PREFS";
    public static final String PREFS_FIRST_START_KEY = "isFirstStart";
    public static final String PREFS_USER_EXISTS_KEY = "userExists";
    public static final String PREFS_USER_NAME = "name";
    public static final String PREFS_USER_EMAIL = "email";
    public static final String PREFS_USER_PUBLIC_KEY = "publicKey";
    public static final String PREFS_USER_PRIVATE_KEY = "privateKey";
    private SharedPreferences settings;
    private static final int PERMISSIONS_CAMERA = 1;
    private static final int PERMISSIONS_STORAGE = 2;
    private static Class<?> activityToStart;

    @BindView(R.id.shareButton) Button shareButton;
    @BindView(R.id.scanButton) Button scanButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        settings = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
        if (firstStart()) {
            SharedPreferences.Editor editor = settings.edit();
            editor.putBoolean(PREFS_FIRST_START_KEY, false);
            editor.commit();
            Intent intent = new Intent(this, IntroActivity.class);
            startActivity(intent);
            finish();
        }
    }

    @OnClick(R.id.shareButton)
    public void share(View view) {
        activityToStart = ShareActivity.class;
        checkCameraPermission();
    }

    @OnClick(R.id.scanButton)
    public void scan(View view) {
        activityToStart = ScanActivity.class;
        checkCameraPermission();
    }

    @OnClick(R.id.fab_exit)
    public void exit(View view) {
        finish();
        System.exit(0);
    }

    @OnClick(R.id.fab_open_source)
    public void opensource(View view) {
        Intent intent = new Intent(this, OpenSourceLicensesActivity.class);
        startActivity(intent);
    }

    private void startAppropriateActivityAfterUserExistsCheck(Context context, Class<?> one, Class<?> two){
        if (!userExists()) {
            final Intent intent = new Intent(context, one);
            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
                    .setTitle("Before you proceed")
                    .setMessage("You must register before being able to access any features of the application. Press OK to register now.")
                    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                            startActivity(intent);
                            finish();
                        }
                    });
            builder.show();
        }
        else {
            Intent intent = new Intent(context, two);
            startActivity(intent);
            finish();
        }
    }

    private boolean userExists() {
        boolean userExists = settings.getBoolean(PREFS_USER_EXISTS_KEY, false);
        return userExists;
    }

    private boolean firstStart() {
        boolean isFirstStart = settings.getBoolean(PREFS_FIRST_START_KEY, true);
        return isFirstStart;
    }

    private void checkCameraPermission() {
        String permission = Manifest.permission.CAMERA;
        if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) {
                makeSnackbar("Allow camera access to scan QR code");
            }
            ActivityCompat.requestPermissions(this, new String[]{permission}, PERMISSIONS_CAMERA);
        }
        else {
            checkStoragePermission();
        }
    }

    private void checkStoragePermission() {
        String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
        if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
            if (ActivityCompat.shouldShowRequestPermissionRationale(this, permission)) {
                makeSnackbar("Allow access to storage");
            }
            ActivityCompat.requestPermissions(this, new String[]{permission}, PERMISSIONS_STORAGE);
        }
        else {
            startAppropriateActivityAfterUserExistsCheck(this, RegisterActivity.class, activityToStart);
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], @NonNull int[] grantResults) {
        switch (requestCode) {
            case PERMISSIONS_CAMERA: {
                if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    checkStoragePermission();
                }
                else {
                    makeAlertDialog("Error!", "The application cannot continue without access to the device camera. Press OK to exit.");
                }
            }
            case PERMISSIONS_STORAGE: {
                if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    startAppropriateActivityAfterUserExistsCheck(this, RegisterActivity.class, ScanActivity.class);
                }
                else {
                    makeAlertDialog("Error!", "The application cannot continue without access to the device storage. Press OK to exit.");
                }
            }
        }
    }

    private void makeSnackbar(String snackbarText) {
        Snackbar.make(getWindow().getDecorView().getRootView(), snackbarText, Snackbar.LENGTH_LONG)
                .setAction("Dismiss", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {}
                })
                .show();
    }

    private void makeAlertDialog(String title, String message){
        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this)
                .setTitle(title)
                .setMessage(message)
                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                        finish();
                    }
                });
        builder.show();
    }
}


text:
var io = require('socket.io-client');
var EE = require('events').EventEmitter;
var inherits = require('util').inherits;

var CONNECTION = 'https://scorebot-secure.hltv.org';
var PORT = 443;

function Livescore(options) {
    options = options || {};

    this.connected = false;
    this.started = false;

    this.listid = JSON.stringify({
        token: '',
        listId: options.listid
    }) || null;

    this.url = options.url || CONNECTION;
    this.port = options.port || PORT;

    this.socket = io(this.url + (this.port === 443 ? '' : ':' + PORT));

    this.time = 0;
    this.map;
    this.interval;

    this.scoreboard;

    this.players = {};
    this.teams = {};

    this.kills = 0;
    this.knifeKills = 0;

    this._lastLog;

    this.options = {};

    this.options[Livescore.Enums.EOption['ROUND_TIME']] = options.roundTime || 115; // 105 before update
    this.options[Livescore.Enums.EOption['BOMB_TIME']] = options.bombTime || 40; // 35 before update
    this.options[Livescore.Enums.EOption['FREEZE_TIME']] = options.freezeTime || 15;

    this.socket.on('connect', this._onConnect.bind(this));
}

inherits(Livescore, EE);

Livescore.Enums = require('../Livescore.js').Enums;
Livescore.Classes = require('../Livescore.js').Classes;

Livescore.prototype.start = function(options, callback) {
    if (typeof options === 'function') {
        callback = options;
        options = {};
    }

    options = options || {};

    this.listid = JSON.stringify({
        token: '',
        listId: options.listid
    }) || null;

    if (this.connected) {
        this.socket.emit('readyForMatch', this.listid);

        if (callback) {
            callback(null);
        }
    } else if (callback) {
        callback(new Error('Not yet connected to HLTV'));
    }
};

Livescore.prototype.disconnect = function() {
    this.connected = false;
    this.socket.disconnect();
};

Livescore.prototype.getPlayers = function(callback) {
    callback(this.players);
};

Livescore.prototype.getTeams = function(callback) {
    callback(this.teams);
};

Livescore.prototype.setTime = function(time) {
    clearInterval(this.interval);

    this.time = time;
    this.interval = setInterval(() => {
        this.time = this.time - 1;
        this.emit('time', this.time);
    }, 1000);
};

Livescore.prototype.getTime = function(callback) {
    callback(this.time);
};

Livescore.prototype._onConnect = function() {
    if (!this.connected) {
        this.connected = true;

        this.socket.on('log', this._onLog.bind(this));
        this.socket.on('scoreboard', this._onScoreboard.bind(this));

        this.emit('connected');
    }

    if (this.listid) {
        this.socket.emit('readyForMatch', this.listid);
    }
};

Livescore.prototype._onReconnect = function() {
    this.socket.emit('readyForMatch', this.listid);
};

Livescore.prototype._onLog = function(logs) {
    try {
        logs = JSON.parse(logs).log.reverse();
    } catch (err) {
        logs = null;

        this.emit('debug', err);
    }

    if (logs && logs !== this._lastLog) {
        this.emit('log', logs);

        this.getPlayers((players) => {
            if (Object.keys(players).length && logs) {
                logs.forEach((log) => {
                    var event;

                    for (event in log) {
                        this.emit('debug', 'received event: ' + event);

                        switch (event) {
                            case 'Kill':
                            case 'Assist':
                            case 'BombPlanted':
                            case 'BombDefused':
                            case 'RoundStart':
                            case 'RoundEnd':
                            case 'PlayerJoin':
                            case 'PlayerQuit':
                            case 'MapChange':
                            case 'MatchStarted':
                            case 'Restart':
                            case 'Suicide':

                                if (typeof this['_on' + event] === 'function') {
                                    this['_on' + event](log[event]);
                                }

                                break;
                            default:
                                this.emit('debug', 'unrecognized event: ' + event);
                                break;
                        }
                    }
                });
            }
        });

        this._lastLog = logs;
    }
};

Livescore.prototype._onScoreboard = function(event) {
    if (!this.started) {
        this.started = true;
        this.emit('started');
    }

    this._updateGame(event);

    this.getTeams((teams) => {
        var scoreboard = new Livescore.Classes.Scoreboard(event);

        scoreboard.teams[Livescore.Enums.ESide['TERRORIST']] = teams[Livescore.Enums.ESide['TERRORIST']];
        scoreboard.teams[Livescore.Enums.ESide['COUNTERTERRORIST']] = teams[Livescore.Enums.ESide['COUNTERTERRORIST']];

        this.emit('scoreboard', scoreboard);
    });
};

Livescore.prototype._onKill = function(event) {
    this.getPlayers((players) => {
        this.emit('kill', {
            killer: players[event.killerName],
            victim: players[event.victimName],
            weapon: event.weapon,
            headshot: event.headShot,
            eventId: event.eventId
        });
    });

    this.kills++;
    if (event.weapon.indexOf('knife') > -1 || event.weapon.indexOf('bayonet') > -1) {
        this.knifeKills++;
    }
};

Livescore.prototype._onSuicide = function(event) {
    this.getPlayers((players) => {
        this.emit('suicide', {
            player: players[event.playerName]
        });
    });
};

Livescore.prototype._onAssist = function(event) {
    this.getPlayers((players) => {
        this.emit('assist', {
            assister: players[event.assisterName],
            victim: players[event.victimName],
            killEventId: event.killEventId
        });
    });
};

Livescore.prototype._onBombPlanted = function(event) {
    this.setTime(this.options[Livescore.Enums.EOption['BOMB_TIME']]);

    this.getPlayers((players) => {
        this.emit('bombPlanted', {
            player: players[event.playerName]
        });
    });
};

Livescore.prototype._onBombDefused = function(event) {
    this.getPlayers((players) => {
        this.emit('bombDefused', {
            player: players[event.playerName]
        });
    });
};

Livescore.prototype._onMatchStarted = function(event) {
    this.emit('matchStart', event);
};

Livescore.prototype._onRoundStart = function() {
    this.setTime(this.options[Livescore.Enums.EOption["ROUND_TIME"]]);
    this.emit('roundStart', {
        round: this.scoreboard.currentRound
    });

    this.kills = 0;
    this.knifeKills = 0;
};

Livescore.prototype._onRoundEnd = function(event) {
    var winner = Livescore.Enums.ESide[event.winner === 'TERRORIST' ? 'TERRORIST' : 'COUNTERTERRORIST'];

    this.setTime(this.options[Livescore.Enums.EOption["FREEZE_TIME"]]);

    this.getTeams((teams) => {
        if (Object.keys(teams).length) {
            teams[Livescore.Enums.ESide['TERRORIST']].score = event.terroristScore;
            teams[Livescore.Enums.ESide['COUNTERTERRORIST']].score = event.counterTerroristScore;

            // If at least 80% of the kills are knife kills, count it as a knife
            // round. Sometimes players will have pistols on knife rounds and
            // kill teammates after the round is over, so this takes that into
            // account.
            this.emit('roundEnd', {
                teams: teams,
                winner: teams[winner],
                roundType: Livescore.Enums.ERoundType[event.winType],
                knifeRound: (this.knifeKills / this.kills) >= 0.8
            });
        }
    });
};

Livescore.prototype._onPlayerJoin = function(event) {
    this.emit('playerJoin', {
        playerName: event.playerName
    });
};

Livescore.prototype._onPlayerQuit = function(event) {
    this.getPlayers((players) => {
        this.emit('playerQuit', {
            player: players[event.playerName]
        });
    });
};

Livescore.prototype._onRestart = function() {
    this.emit('restart');
};

Livescore.prototype._onMapChange = function(event) {
    this.emit('mapChange', event);
};

Livescore.prototype._updateGame = function(scoreboard) {
    var tPlayers = [];
    var ctPlayers = [];

    this.teams[Livescore.Enums.ESide['TERRORIST']] = new Livescore.Classes.Team({
        name: scoreboard.terroristTeamName,
        id: scoreboard.tTeamId,
        score: scoreboard.terroristScore,
        side: Livescore.Enums.ESide['TERRORIST'],
        players: tPlayers,
        history: scoreboard.terroristMatchHistory
    });

    this.teams[Livescore.Enums.ESide['COUNTERTERRORIST']] = new Livescore.Classes.Team({
        name: scoreboard.ctTeamName,
        id: scoreboard.ctTeamId,
        score: scoreboard.counterTerroristScore,
        side: Livescore.Enums.ESide['COUNTERTERRORIST'],
        players: ctPlayers,
        history: scoreboard.ctMatchHistory
    });

    this.getTeams((teams) => {
        scoreboard.TERRORIST.forEach((pl) => {
            var player = new Livescore.Classes.Player(pl);
            player.team = teams[Livescore.Enums.ESide['TERRORIST']];

            this.players[player.name] = player;
            tPlayers.push(player);
        });

        scoreboard.CT.forEach((pl) => {
            var player = new Livescore.Classes.Player(pl);
            player.team = teams[Livescore.Enums.ESide['COUNTERTERRORIST']];

            this.players[player.name] = player;
            ctPlayers.push(player);
        });
    });

    this.scoreboard = scoreboard;
};

module.exports = Livescore;


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>

#include "mscorlib_System_MulticastDelegate3201952435.h"
#include "mscorlib_System_Void1841601450.h"

// UnityEngine.Networking.Match.DropConnectionResponse
struct DropConnectionResponse_t3742478148;
// UnityEngine.Networking.Match.NetworkMatch/BasicResponseDelegate
struct BasicResponseDelegate_t1347328110;
// System.IAsyncResult
struct IAsyncResult_t1999651008;
// System.AsyncCallback
struct AsyncCallback_t163412349;
// System.Object
struct Il2CppObject;

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif

// UnityEngine.Networking.Match.NetworkMatch/InternalResponseDelegate`2<UnityEngine.Networking.Match.DropConnectionResponse,UnityEngine.Networking.Match.NetworkMatch/BasicResponseDelegate>
struct  InternalResponseDelegate_2_t758376842  : public MulticastDelegate_t3201952435
{
public:

public:
};

#ifdef __clang__
#pragma clang diagnostic pop
#endif


text:
package kbasesearchengine.test.system;

import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import org.junit.Test;

import com.google.common.base.Optional;

import kbasesearchengine.system.LocationTransformType;
import kbasesearchengine.system.SearchObjectType;
import kbasesearchengine.system.Transform;
import kbasesearchengine.system.TransformType;
import kbasesearchengine.test.common.TestCommon;
import nl.jqno.equalsverifier.EqualsVerifier;

public class TransformTest {

    @Test
    public void equals() {
        EqualsVerifier.forClass(Transform.class).usingGetClass().verify();
    }

    @Test
    public void string() {
        final Transform t = Transform.string();
        assertThat("incorrect type", t.getType(), is(TransformType.string));
        assertEmptyFields(t);
    }

    private void assertEmptyFields(final Transform t) {
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(), is(Optional.absent()));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void integer() {
        final Transform t = Transform.integer();
        assertThat("incorrect type", t.getType(), is(TransformType.integer));
        assertEmptyFields(t);
    }

    @Test
    public void value() {
        final Transform t = Transform.values();
        assertThat("incorrect type", t.getType(), is(TransformType.values));
        assertEmptyFields(t);
    }

    @Test
    public void location() {
        final Transform t = Transform.location(LocationTransformType.contig_id);
        assertThat("incorrect type", t.getType(), is(TransformType.location));
        assertThat("incorrect location", t.getLocation(),
                is(Optional.of(LocationTransformType.contig_id)));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(), is(Optional.absent()));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));

    }

    @Test
    public void locationFail() {
        try {
            Transform.location(null);
            fail("expected exception");
        } catch (Exception got) {
            TestCommon.assertExceptionCorrect(got, new NullPointerException("location"));
        }
    }

    @Test
    public void lookup() {
        final Transform t = Transform.lookup("foo");
        assertThat("incorrect type", t.getType(), is(TransformType.lookup));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.of("foo")));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(), is(Optional.absent()));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void lookupFail() {
        failLookup(null, new IllegalArgumentException("targetKey cannot be null or whitespace"));
        failLookup("   \t   \n ",
                new IllegalArgumentException("targetKey cannot be null or whitespace"));
    }

    private void failLookup(final String lookup, final Exception expected) {
        try {
            Transform.lookup(lookup);
            fail("expected exception");
        } catch (Exception got) {
            TestCommon.assertExceptionCorrect(got, expected);
        }
    }

    @Test
    public void guid() {
        final Transform t = Transform.guid(new SearchObjectType("foo", 1));
        assertThat("incorrect type", t.getType(), is(TransformType.guid));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(),
                is(Optional.of(new SearchObjectType("foo", 1))));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void guidWithSubobject() {
        final Transform t = Transform.guid(new SearchObjectType("foo", 1), "bar");
        assertThat("incorrect type", t.getType(), is(TransformType.guid));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(),
                is(Optional.of(new SearchObjectType("foo", 1))));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.of("bar")));
    }

    @Test
    public void guidFail() {
        failGuid(null,
                new NullPointerException("targetObjectType"));
        failGuid(null, "foo",
                new NullPointerException("targetObjectType"));
        failGuid(new SearchObjectType("foo", 1), null,
                new IllegalArgumentException("subObjectIDKey cannot be null or whitespace"));
        failGuid(new SearchObjectType("foo", 1), "  \n   \t  ",
                new IllegalArgumentException("subObjectIDKey cannot be null or whitespace"));
    }

    private void failGuid(
            final SearchObjectType targetObjectType,
            final Exception expected) {
        try {
            Transform.guid(targetObjectType);
            fail("expected exception");
        } catch (Exception got) {
            TestCommon.assertExceptionCorrect(got, expected);
        }
    }

    private void failGuid(
            final SearchObjectType targetObjectType,
            final String subObjectIDKey,
            final Exception expected) {
        try {
            Transform.guid(targetObjectType, subObjectIDKey);
            fail("expected exception");
        } catch (Exception got) {
            TestCommon.assertExceptionCorrect(got, expected);
        }
    }

    @Test
    public void unknownValues() {
        final Transform t = Transform.unknown("values", "foo", "bar", null, "baz");
        assertThat("incorrect type", t.getType(), is(TransformType.values));
        assertEmptyFields(t);
    }

    @Test
    public void unknownString() {
        final Transform t = Transform.unknown("string", "foo", "bar", 1, "baz");
        assertThat("incorrect type", t.getType(), is(TransformType.string));
        assertEmptyFields(t);
    }

    @Test
    public void unknownInteger() {
        final Transform t = Transform.unknown("integer", "foo", "bar", -23, "baz");
        assertThat("incorrect type", t.getType(), is(TransformType.integer));
        assertEmptyFields(t);
    }

    @Test
    public void unknownLocation() {
        final Transform t = Transform.unknown("location", "start", "bar", null, "baz");
        assertThat("incorrect type", t.getType(), is(TransformType.location));
        assertThat("incorrect location", t.getLocation(),
                is(Optional.of(LocationTransformType.start)));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(), is(Optional.absent()));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void unknownLookup() {
        final Transform t = Transform.unknown("lookup", "whee", "bar", null, "baz");
        assertThat("incorrect type", t.getType(), is(TransformType.lookup));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.of("whee")));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(), is(Optional.absent()));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void unknownGuid() {
        unknownGuid(null);
        unknownGuid("  \t  \n  ");
    }

    private void unknownGuid(final String subObjectIDKey) {
        final Transform t = Transform.unknown("guid", "foo", "whoo", 1, subObjectIDKey);
        assertThat("incorrect type", t.getType(), is(TransformType.guid));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(),
                is(Optional.of(new SearchObjectType("whoo", 1))));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.absent()));
    }

    @Test
    public void unknownGuidWithSubObjectIDKey() {
        final Transform t = Transform.unknown("guid", "foo", "whoo", 6, "whoop");
        assertThat("incorrect type", t.getType(), is(TransformType.guid));
        assertThat("incorrect location", t.getLocation(), is(Optional.absent()));
        assertThat("incorrect targetKey", t.getTargetKey(), is(Optional.absent()));
        assertThat("incorrect targetObjectType", t.getTargetObjectType(),
                is(Optional.of(new SearchObjectType("whoo", 6))));
        assertThat("incorrect subObjectIDKey", t.getSubobjectIdKey(), is(Optional.of("whoop")));
    }

    @Test
    public void unknownFailTransformType() {
        failUnknown(null, null, null, null, null,
                new IllegalArgumentException("transform cannot be null or whitespace"));
        failUnknown("   \t  \n  ", null, null, null, null,
                new IllegalArgumentException("transform cannot be null or whitespace"));
        failUnknown("foo", null, null, null, null,
                new IllegalArgumentException("Illegal transform type: foo"));
    }

    @Test
    public void unknownFailLocation() {
        failUnknown("location", null, "foo", null, "bar", new IllegalArgumentException(
                "location transform location type cannot be null or whitespace"));
        failUnknown("location", "   \t   \n  ", "foo", null, "bar", new IllegalArgumentException(
                "location transform location type cannot be null or whitespace"));
        failUnknown("location", "badloc", "foo", 1, "bar", new IllegalArgumentException(
                "Illegal transform location: badloc"));
    }

    @Test
    public void unknownFailLookup() {
        failUnknown("lookup", null, "foo", null, "bar", new IllegalArgumentException(
                "lookup transform target key cannot be null or whitespace"));
        failUnknown("lookup", "   \t   \n  ", "foo", 2, "bar", new IllegalArgumentException(
                "lookup transform target key cannot be null or whitespace"));
    }

    @Test
    public void unknownFailGuid() {
        failUnknown("guid", "bleah", null, 1, "bar", new IllegalArgumentException(
                "targetObjectType cannot be null or whitespace"));
        failUnknown("guid", "bleah", "  \t   \n  ", 1, "bar", new IllegalArgumentException(
                "targetObjectType cannot be null or whitespace"));
        failUnknown("guid", "bleah", "type", null, "bar", new NullPointerException(
                "targetObjectTypeVersion cannot be null"));
    }

    private void failUnknown(
            final String transform,
            final String locationOrTargetKey,
            final String targetObjectType,
            final Integer targetObjectTypeVer,
            final String subObjectIDKey,
            final Exception expected) {
        try {
            Transform.unknown(transform, locationOrTargetKey,
                    targetObjectType, targetObjectTypeVer, subObjectIDKey);
            fail("expected exception");
        } catch (Exception got) {
            TestCommon.assertExceptionCorrect(got, expected);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace RoboSharp.BackupApp
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
    }
}


text:
package com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;

import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteBidAdjustmentTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteCampaignNameTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteFromHourTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteFromMinuteTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteIdTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteParentIdTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteStatusTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteTargetTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteToHourTest;
import com.microsoft.bingads.v12.api.test.entities.criterions.campaign.daytime.write.BulkCampaignDayTimeCriterionWriteToMinuteTest;

@RunWith(Suite.class)
@Suite.SuiteClasses({
        BulkCampaignDayTimeCriterionWriteIdTest.class,
        BulkCampaignDayTimeCriterionWriteParentIdTest.class,
        BulkCampaignDayTimeCriterionWriteStatusTest.class,
        BulkCampaignDayTimeCriterionWriteCampaignNameTest.class,
        BulkCampaignDayTimeCriterionWriteTargetTest.class,
        BulkCampaignDayTimeCriterionWriteBidAdjustmentTest.class,
        BulkCampaignDayTimeCriterionWriteFromHourTest.class,
        BulkCampaignDayTimeCriterionWriteToHourTest.class,
        BulkCampaignDayTimeCriterionWriteFromMinuteTest.class,
        BulkCampaignDayTimeCriterionWriteToMinuteTest.class
})
public class BulkCampaignDayTimeCriterionWriteTests {
}


text:
<?php
namespace Oro\Bundle\EmailBundle\Form\EventListener;

use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Security\Core\SecurityContextInterface;

use Oro\Bundle\FormBundle\Utils\FormUtils;
use Oro\Bundle\NotificationBundle\Entity\EmailNotification;
use Oro\Bundle\EmailBundle\Entity\Repository\EmailTemplateRepository;
use Oro\Bundle\SecurityBundle\Authentication\Token\UsernamePasswordOrganizationToken;

/**
 * BuildTemplateFormSubscriber used for populating templates choices
 *
 * @package Oro\Bundle\EmailBundle
 */
class BuildTemplateFormSubscriber implements EventSubscriberInterface
{
    /**
     * @var SecurityContextInterface
     */
    protected $securityContext;

    /**
     * @param SecurityContextInterface $securityContext
     */
    public function __construct(SecurityContextInterface $securityContext)
    {
        $this->securityContext = $securityContext;
    }

    /**
     * {@inheritdoc}
     */
    public static function getSubscribedEvents()
    {
        return [
            FormEvents::PRE_SET_DATA => 'preSetData',
            FormEvents::PRE_SUBMIT   => 'preSubmit'
        ];
    }

    /**
     * Adds a template field based on the entity set
     *
     * @param FormEvent $event
     */
    public function preSetData(FormEvent $event)
    {
        /** @var EmailNotification $eventObject */
        $eventObject = $event->getData();
        if (null === $eventObject || null === $eventObject->getEntityName()) {
            return;
        }

        $this->initChoicesByEntityName($eventObject->getEntityName(), 'template', $event->getForm());
    }

    /**
     * Adds a template field based on the entity set on submitted form
     *
     * @param FormEvent $event
     */
    public function preSubmit(FormEvent $event)
    {
        /** @var EmailNotification $eventObject */
        $data = $event->getData();
        if (empty($data['entityName'])) {
            return;
        }

        $this->initChoicesByEntityName($data['entityName'], 'template', $event->getForm());
    }

    /**
     * Replace email template field with new choices configuration
     *
     * @param string        $entityName
     * @param string        $fieldName
     * @param FormInterface $form
     */
    protected function initChoicesByEntityName($entityName, $fieldName, FormInterface $form)
    {
        /** @var UsernamePasswordOrganizationToken $token */
        $token        = $this->securityContext->getToken();
        $organization = $token->getOrganizationContext();

        FormUtils::replaceField(
            $form,
            $fieldName,
            [
                'selectedEntity' => $entityName,
                'query_builder'  =>
                    function (EmailTemplateRepository $templateRepository) use (
                        $entityName,
                        $organization
                    ) {
                        return $templateRepository->getEntityTemplatesQueryBuilder($entityName, $organization);
                    },
            ],
            ['choice_list', 'choices']
        );
    }
}