text:
<?php
// GENERATED CODE -- DO NOT EDIT!

// Original file comments:
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
namespace Google\Cloud\Redis\V1beta1;

/**
 * Configures and manages Cloud Memorystore for Redis instances
 *
 * Google Cloud Memorystore for Redis v1beta1
 *
 * The `redis.googleapis.com` service implements the Google Cloud Memorystore
 * for Redis API and defines the following resource model for managing Redis
 * instances:
 * * The service works with a collection of cloud projects, named: `/projects/*`
 * * Each project has a collection of available locations, named: `/locations/*`
 * * Each location has a collection of Redis instances, named: `/instances/*`
 * * As such, Redis instances are resources of the form:
 *   `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
 *
 * Note that location_id must be referring to a GCP `region`; for example:
 * * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
 */
class CloudRedisGrpcClient extends \Grpc\BaseStub {

    /**
     * @param string $hostname hostname
     * @param array $opts channel options
     * @param \Grpc\Channel $channel (optional) re-use channel object
     */
    public function __construct($hostname, $opts, $channel = null) {
        parent::__construct($hostname, $opts, $channel);
    }

    /**
     * Lists all Redis instances owned by a project in either the specified
     * location (region) or all locations.
     *
     * The location should have the following format:
     *
     * * `projects/{project_id}/locations/{location_id}`
     *
     * If `location_id` is specified as `-` (wildcard), then all regions
     * available to the project are queried, and the results are aggregated.
     * @param \Google\Cloud\Redis\V1beta1\ListInstancesRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function ListInstances(\Google\Cloud\Redis\V1beta1\ListInstancesRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/ListInstances',
        $argument,
        ['\Google\Cloud\Redis\V1beta1\ListInstancesResponse', 'decode'],
        $metadata, $options);
    }

    /**
     * Gets the details of a specific Redis instance.
     * @param \Google\Cloud\Redis\V1beta1\GetInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function GetInstance(\Google\Cloud\Redis\V1beta1\GetInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/GetInstance',
        $argument,
        ['\Google\Cloud\Redis\V1beta1\Instance', 'decode'],
        $metadata, $options);
    }

    /**
     * Creates a Redis instance based on the specified tier and memory size.
     *
     * By default, the instance is accessible from the project's
     * [default network](https://cloud.google.com/vpc/docs/vpc).
     *
     * The creation is executed asynchronously and callers may check the returned
     * operation to track its progress. Once the operation is completed the Redis
     * instance will be fully functional. The completed longrunning.Operation will
     * contain the new instance object in the response field.
     *
     * The returned operation is automatically deleted after a few hours, so there
     * is no need to call DeleteOperation.
     * @param \Google\Cloud\Redis\V1beta1\CreateInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function CreateInstance(\Google\Cloud\Redis\V1beta1\CreateInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/CreateInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Updates the metadata and configuration of a specific Redis instance.
     *
     * Completed longrunning.Operation will contain the new instance object
     * in the response field. The returned operation is automatically deleted
     * after a few hours, so there is no need to call DeleteOperation.
     * @param \Google\Cloud\Redis\V1beta1\UpdateInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function UpdateInstance(\Google\Cloud\Redis\V1beta1\UpdateInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/UpdateInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Upgrades Redis instance to the newer Redis version specified in the
     * request.
     * @param \Google\Cloud\Redis\V1beta1\UpgradeInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function UpgradeInstance(\Google\Cloud\Redis\V1beta1\UpgradeInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/UpgradeInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
     *
     * Redis may stop serving during this operation. Instance state will be
     * IMPORTING for entire operation. When complete, the instance will contain
     * only data from the imported file.
     *
     * The returned operation is automatically deleted after a few hours, so
     * there is no need to call DeleteOperation.
     * @param \Google\Cloud\Redis\V1beta1\ImportInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function ImportInstance(\Google\Cloud\Redis\V1beta1\ImportInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/ImportInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Export Redis instance data into a Redis RDB format file in Cloud Storage.
     *
     * Redis will continue serving during this operation.
     *
     * The returned operation is automatically deleted after a few hours, so
     * there is no need to call DeleteOperation.
     * @param \Google\Cloud\Redis\V1beta1\ExportInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function ExportInstance(\Google\Cloud\Redis\V1beta1\ExportInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/ExportInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Initiates a failover of the primary node to current replica node for a
     * specific STANDARD tier Cloud Memorystore for Redis instance.
     * @param \Google\Cloud\Redis\V1beta1\FailoverInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function FailoverInstance(\Google\Cloud\Redis\V1beta1\FailoverInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/FailoverInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

    /**
     * Deletes a specific Redis instance.  Instance stops serving and data is
     * deleted.
     * @param \Google\Cloud\Redis\V1beta1\DeleteInstanceRequest $argument input argument
     * @param array $metadata metadata
     * @param array $options call options
     * @return \Grpc\UnaryCall
     */
    public function DeleteInstance(\Google\Cloud\Redis\V1beta1\DeleteInstanceRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.redis.v1beta1.CloudRedis/DeleteInstance',
        $argument,
        ['\Google\LongRunning\Operation', 'decode'],
        $metadata, $options);
    }

}

redpajama_set_name: RedPajamaGithub


text:
California sea lion pups are counted at San Miguel Island, California. Live
pups are counted at the end of July each year, after all pups have been born.
Pups are weighed in September or October each year and weights are adjusted
using a mixed effects model to a 1 October weighing date. Growth rates are
predicted from a longitudinal sample of uniquely marked pups that are
captured in October and again the following February. Growth rates are
modeled using a mixed effects model and standard errors are estimated using
bootstrap. NOAA AFSC/MML http://www.noaa.gov/iea/Assets/iea/california/Report/pdf/10.%20Marine%20Mammals_2013.pdf


text:
import * as utils from '../utils/utils';

export default class SVGElement {

	constructor( options, $svg ) {

		this._defaults = {
			namespace: 'http://www.w3.org/2000/svg'
		};

	}

	get defaults() {

		return this._defaults;

	}

	set defaults( defaults) {

		if ( this._defaults ) {

			this._defaults =  utils.extend( this._defaults, defaults );

		} else {

			this._defaults = defaults;

		}

	}

	get attributes() {

		return this._attributes;

	}

	set attributes( attributes ) {

		if ( this._attributes ) {

			this._attributes =  utils.extend( this._attributes, attributes );

		} else {

			this._attributes = attributes;

		}
	}

	init( options, attributes ) {

		this.options = utils.extend( this.defaults, options );
		this.attributes = utils.extend( this.attributes, options );
		this.el = this.createEl();
		this.mapAttributes();

	}

	mapAttributes() {

		Object.keys( this.attributes ).forEach( ( k, i ) => {

			this.el.setAttribute( k, this.attributes[k] );

		} );

	}

	createEl() {

		return document.createElementNS( this.options.namespace, this.options.name );

	}

	setAttribute( attributeName, attributeVal ) {

		this.attributes[attributeName] = attributeVal;
		this.mapAttributes();

	}

}


text:
package org.kie.scanner.embedder;

import org.apache.maven.settings.Settings;
import org.apache.maven.settings.building.DefaultSettingsBuilderFactory;
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
import org.apache.maven.settings.building.SettingsBuilder;
import org.apache.maven.settings.building.SettingsBuildingException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

public class MavenSettings {

    private static final Logger log = LoggerFactory.getLogger(MavenSettings.class);

    private static final String CUSTOM_SETTINGS_PROPERTY = "kie.maven.settings.custom";

    private static class SettingsHolder {
        private static final File userSettingsFile = initUserSettingsFile();
        private static final Settings settings = initSettings(userSettingsFile);
    }

    public static File getUserSettingsFile() {
        return SettingsHolder.userSettingsFile;
    }

    public static Settings getSettings() {
        return SettingsHolder.settings;
    }

    private static Settings initSettings(File userSettingsFile) {
        SettingsBuilder settingsBuilder = new DefaultSettingsBuilderFactory().newInstance();
        DefaultSettingsBuildingRequest request = new DefaultSettingsBuildingRequest();

        if (userSettingsFile != null) {
            request.setUserSettingsFile( userSettingsFile );
        }

        String mavenHome = System.getenv( "M2_HOME" );
        if (mavenHome != null) {
            File globalSettingsFile = new File( mavenHome + "/conf/settings.xml" );
            if (globalSettingsFile.exists()) {
                request.setGlobalSettingsFile( globalSettingsFile );
            }
        } else {
            log.warn("Environment variable M2_HOME is not set");
        }

        request.setSystemProperties( System.getProperties() );

        Settings settings = null;
        try {
            settings = settingsBuilder.build( request ).getEffectiveSettings();
        } catch ( SettingsBuildingException e ) {
            throw new RuntimeException(e);
        }

        if (settings.getLocalRepository() == null) {
            String userHome = System.getProperty( "user.home" );
            if (userHome != null) {
                settings.setLocalRepository( userHome + "/.m2/repository" );
            } else {
                log.error("Cannot find maven local repository");
            }
        }

        return settings;
    }

    private static File initUserSettingsFile() {
        String customSettings = System.getProperty( CUSTOM_SETTINGS_PROPERTY );
        if (customSettings != null) {
            File customSettingsFile = new File( customSettings );
            if (customSettingsFile.exists()) {
                return customSettingsFile;
            } else {
                log.warn("Cannot find custom maven settings file: " + customSettings);
            }
        }

        String userHome = System.getProperty( "user.home" );
        if (userHome != null) {
            File userSettingsFile = new File( userHome + "/.m2/settings.xml" );
            if (userSettingsFile.exists()) {
                return userSettingsFile;
            }
        } else {
            log.warn("User home is not set");
        }

        return null;
    }
}


text:
require 'kumogata/template/helper'

def _s3_to_deletion_policy(value)
  return "Retain" if value.nil?

  case value
  when "delete"
    "Delete"
  when "retain"
    "Retain"
  when "shapshot"
    "Snapshot"
  else
    _valid_values(value, %w( Delete Retain Snapshot ), "Retain")
  end
end

def _s3_to_access(value)
  return "Private" if value.nil?

  case value
  when "auth read"
    "AuthenticatedRead"
  when "aws exec read"
    "AwsExecRead"
  when "owner read"
    "BucketOwnerRead"
  when "owner full"
    "BucketOwnerFullControl"
  when "log delivery write"
    "LogDeliveryWrite"
  when "private"
    "Private"
  when "public read"
    "PublicRead"
  when "public read write"
    "PublicReadWrite"
  else
    value
  end
end

def _s3_to_lifecycle_storage(value)
  case value
  when "ia"
    "STANDARD_IA"
  else
    "GLACIER"
  end
end

def _s3_to_lifecycle_move_to_glacier(exp_in_days = 1, trans_in_days = 1, prefix = "")
  lifecycle = {
    exp_in_days: exp_in_days,
    id: "lifecycle rule - move to glacier expiration / transition in days: #{exp_in_days} / #{trans_in_days}",
    transitions: [
                   { storage: "glacier", in_days: trans_in_days },
                  ],
  }
  lifecycle[:prefix] = prefix unless prefix.empty?
  lifecycle
end

def _s3_to_notification_event_type(value)
  type =
    case value
    when 'create all', 'new'
      'ObjectCreated:*'
    when 'put'
      'ObjectCreated:Put'
    when 'post'
      'ObjectCreated:Post'
    when 'copy'
      'ObjectCreated:Copy'
    when 'upload'
      'ObjectCreated:CompleteMultipartUpload'
    when 'delete all', 'remove all'
      'ObjectRemoved:*'
    when 'delete'
      'ObjectRemoved:Delete'
    when 'delete marker'
      'ObjectRemoved:DeleteMarkerCreated'
    when 'lost'
      'ReducedRedundancyLostObject'
    end
  "s3:#{type}"
end

def _s3_cors(args)
  rules = (args[:cors] || []).collect do |rule|
    _{
      AllowedHeaders _array(rule[:headers]) if rule.key? :headers
      AllowedMethods _array(rule[:methods])
      AllowedOrigins _array(rule[:origins])
      ExposedHeaders _array(rule[:exposed_headers]) if rule.key? :exposed_headers
      Id rule[:id] if rule.key? :id
      MaxAge rule[:max_age] if rule.key? :max_age
    }
  end
  return rules if rules.empty?

  _{
    CorsRules rules
  }
end

def _s3_lifecycle(args)
  rules = (args[:lifecycles] || []).collect do |rule|
    noncurrent_transitions = _s3_lifecycle_noncurrent_version_transition(rule)
    status =
      if rule.key? :status
        _bool('status', rule, true) ? "Enabled" : "Disabled"
      else
        "Enabled"
      end
    transitions = _s3_lifecycle_transition(rule)

    _{
      ExpirationDate _timestamp_utc(rule[:exp_date]) if rule.key? :exp_date
      ExpirationInDays rule[:exp_in_days] if rule.key? :exp_in_days
      Id rule[:id] if rule.key? :id
      NoncurrentVersionExpirationInDays rule[:non_exp_in_days] if rule.key? :non_exp_in_days
      NoncurrentVersionTransitions noncurrent_transitions unless noncurrent_transitions.empty?
      Prefix rule[:prefix] if rule.key? :prefix
      Status status
      Transitions transitions unless transitions.empty?
    }
  end
  return rules if rules.empty?

  _{
    Rules rules
  }
end

def _s3_lifecycle_noncurrent_version_transition(args)
  (args[:noncurrent_version_transitions] || []).collect do |transition|
    _{
      StorageClass _s3_to_lifecycle_storage(transition[:storage])
      TransitionInDays transition[:in_days]
    }
  end
end

def _s3_lifecycle_transition(args)
  (args[:transitions] || []).collect do |transition|
    _{
      StorageClass _s3_to_lifecycle_storage(transition[:storage])
      TransitionDate _timestamp_utc(transition[:date]) if transition.key? :date
      TransitionInDays transition[:in_days]
    }
  end
end

def _s3_logging(args)
  logging = args[:logging] || {}
  return logging if logging.empty?

  _{
    DestinationBucketName logging[:destination]
    LogFilePrefix logging[:prefix] || ""
  }
end

def _s3_notification(args)
  notification = args[:notification] || {}
  return notification if notification.empty?

  lambda = _s3_notification_configuration(notification, :lambda)
  queue = _s3_notification_configuration(notification, :queue)
  topic = _s3_notification_configuration(notification, :topic)

  _{
    LambdaConfigurations lambda unless lambda.empty?
    QueueConfigurations queue unless queue.empty?
    TopicConfigurations topic unless topic.empty?
  }
end

def _s3_notification_configuration(args, key)
  return {} unless args.key? key.to_sym

  args[key.to_sym].collect do |value|
    _{
      Event _s3_to_notification_event_type(value[:event])
      Filter _{
        S3Key _{
          Rules value[:filters].collect{|v|
            filter = []
            v.each_pair do |kk, vv|
              filter << _{
                Name kk
                Value vv
              }
            end
            filter
          }.flatten
        }
      } if value.key? :filters
      case key.to_sym
      when :lambda
        Function _ref_attr_string("function", "Arn", value, "lambda function", "arn")
      when :queue
        Queue _ref_attr_string("queue", "Arn", value, "queue")
      when :topic
        Topic _ref_string("topic", value, "topic")
      end
    }
  end
end

def _s3_replication(args)
  replication = args[:replication] || {}
  return replication if replication.empty?

  rules = _s3_replication_rules(replication)

  _{
    Role replication[:role]
    Rules rules
  }
end

def _s3_replication_rules(args)
  (args[:rules] || []).collect do |rule|
    destination = _s3_replication_rules_destination(rule[:destination])
    _{
      Destination destination
      Id rule[:id]
      Prefix rule[:prefix]
      Status rule[:status]
    }
  end
end

def _s3_replication_rules_destination(args)
  _{
    Bucket args[:bucket]
    StorageClass args[:storage]
  }
end

def _s3_versioning(args)
  return "" unless args.key? :versioning

  status =
    if _bool("versioning", args, false)
      "Enabled"
    else
      "Suspended"
    end
  _{
    Status status
  }
end

def _s3_website(args)
  website = args[:website] || ""
  return website if website.empty?

  redirect = _s3_website_redirect_all_request(website)
  routing = _s3_website_routing_rules(website)

  _{
    ErrorDocument website[:error] || "error.html"
    IndexDocument website[:index] || "index.html"
    RedirectAllRequestsTo redirect unless redirect.empty?
    RoutingRules routing unless routing.empty?
  }
end

def _s3_website_redirect_all_request(args)
  redirect = args[:redirect] || {}
  return redirect if redirect.empty?

  _{
    HostName redirect[:hostname]
    Protocol _valid_values(redirect[:protocol], %w( http https ), "http")
  }
end

def _s3_website_routing_rules(args)
  (args[:routing] || []).collect do |route|
    _{
      RedirectRule do
        redirect = route[:redirect] || {}
        HostName redirect[:host] if redirect.key? :host
        HttpRedirectCode redirect[:http] if redirect.key? :http
        Protocol redirect[:protocol] if redirect.key? :protocol
        ReplaceKeyPrefixWith redirect[:replace_key_prefix] if redirect.key? :replace_key_prefix
        ReplaceKeyWith redirect[:replace_key_with] if redirect.key? :replace_key_with
      end
      RoutingRuleCondition do
        routing = route[:routing] || {}
        HttpErrorCodeReturnedEquals routing[:http]
        KeyPrefixEquals routing[:key_prefix]
      end
    }
  end
end


text:
Includes all the required assets plus examples.

Download MochaUI version 0.9.8


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.maps.search.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.models.GeoPosition;

/**
 * Class holding optional parameters for Search.
 */
@Fluent
public final class ReverseSearchCrossStreetAddressOptions extends BaseReverseSearchOptions<ReverseSearchCrossStreetAddressOptions> {
    private Integer top;

    /**
     * Builds reverse cross street search options with coordinates.
     * @param coordinates The {@link GeoPosition} coordinates to be searched.
     */
    public ReverseSearchCrossStreetAddressOptions(GeoPosition coordinates) {
        this.setCoordinates(coordinates);
    }

    /**
     * Returns the top value.
     * @return the top value.
     */
    public Integer getTop() {
        return top;
    }

    /**
     * Sets the top value.
     * @param top the top value.
     * @return a reference to this {@code ReverseSearchCrossStreetAddressOptions}
     */
    public ReverseSearchCrossStreetAddressOptions setTop(Integer top) {
        this.top = top;
        return this;
    }
}


text:
package org.apache.spark.status.api.v1.streaming

import java.util.{ArrayList => JArrayList, Arrays => JArrays, Date, List => JList}
import javax.ws.rs.{GET, Produces, QueryParam}
import javax.ws.rs.core.MediaType

import org.apache.spark.status.api.v1.streaming.AllBatchesResource._
import org.apache.spark.streaming.ui.StreamingJobProgressListener

@Produces(Array(MediaType.APPLICATION_JSON))
private[v1] class AllBatchesResource(listener: StreamingJobProgressListener) {

  @GET
  def batchesList(@QueryParam("status") statusParams: JList[BatchStatus]): Seq[BatchInfo] = {
    batchInfoList(listener, statusParams).sortBy(- _.batchId)
  }
}

private[v1] object AllBatchesResource {

  def batchInfoList(
      listener: StreamingJobProgressListener,
      statusParams: JList[BatchStatus] = new JArrayList[BatchStatus]()): Seq[BatchInfo] = {

    listener.synchronized {
      val statuses =
        if (statusParams.isEmpty) JArrays.asList(BatchStatus.values(): _*) else statusParams
      val statusToBatches = Seq(
        BatchStatus.COMPLETED -> listener.retainedCompletedBatches,
        BatchStatus.QUEUED -> listener.waitingBatches,
        BatchStatus.PROCESSING -> listener.runningBatches
      )

      val batchInfos = for {
        (status, batches) <- statusToBatches
        batch <- batches if statuses.contains(status)
      } yield {
        val batchId = batch.batchTime.milliseconds
        val firstFailureReason = batch.outputOperations.flatMap(_._2.failureReason).headOption

        new BatchInfo(
          batchId = batchId,
          batchTime = new Date(batchId),
          status = status.toString,
          batchDuration = listener.batchDuration,
          inputSize = batch.numRecords,
          schedulingDelay = batch.schedulingDelay,
          processingTime = batch.processingDelay,
          totalDelay = batch.totalDelay,
          numActiveOutputOps = batch.numActiveOutputOp,
          numCompletedOutputOps = batch.numCompletedOutputOp,
          numFailedOutputOps = batch.numFailedOutputOp,
          numTotalOutputOps = batch.outputOperations.size,
          firstFailureReason = firstFailureReason
        )
      }

      batchInfos
    }
  }
}


text:
(() => {
    let ElementArrayFinder = $$(``).constructor;
    const base = new Base();
    Object.assign(ElementArrayFinder.prototype, {

        async checkPresent(msg) {
            (await this.isPresent()).should.eq(true, msg || `check that element is present: ${this.locator()}`);
        },

        async checkNotPresent(msg) {
            (await this.isPresent()).should.eq(false, msg || `check that element is not present: ${this.locator()}`);
        },

        async checkDisplayed(msg) {
            (await this.isDisplayedOneOf()).should.eq(true, msg || `check that one of elements is displayed: ${this.locator()}`);
        },

        async checkNotDisplayed(msg) {
            (await this.isDisplayedOneOf()).should.eq(false, msg || `check that all elements are not displayed: ${this.locator()}`);
        },

        async checkTextListEqual(expectedList, msg) {
            (await this.getTextList()).should.eql(expectedList, msg || `check that text list equal: ${this.locator()}`);
        },

        async checkTextListNotEqual(expectedList, msg) {
            (await this.getTextList()).should.not.eql(expectedList, msg || `check that text list not equal: ${this.locator()}`);
        },

        async checkTextListIncludeMember(member, msg) {
            (await this.getTextList()).should.include(member, msg || `check that text list include the member: ${this.locator()}`);
        },

        async checkTextListIncludeMembers(membersList, msg) {
            (await this.getTextList()).should.include.members(membersList, msg || `check that text list include members: ${this.locator()}`);
        },

        async checkTextListAllBeOneOf(membersList, msg) {
            (await this.getTextList()).should.all.be.oneOf(membersList, msg || `check list include members: ` + this.locator());
        },

        async checkTextListNotIncludeMember(member, msg) {
            (await this.getTextList()).should.not.include(member, msg || `check list not include member: ` + this.locator());
        },

        async checkTextListNotIncludeMembers(membersList, msg) {
            (await this.getTextList()).should.not.include.members(membersList, msg || `check list not include members: ` + this.locator());
        },

        async checkTextListHaveMembers(membersList, msg) {
            (await this.getTextList()).should.have.members(membersList, msg || `check that text list have members: ${this.locator()}`);
        },

        async checkListCount(expectedCount, msg) {
            (await this.count()).should.eql(expectedCount, msg || `check that list count: ${this.locator()}`);
        },

        async checkTextListMatch(regexp, msg, lowerCase) {
            if (lowerCase) {
                (await this.getTextListLowerCase()).should.match(regexp, msg || `check that text list match: ${this.locator()}`);
            } else {
                (await this.getTextList()).should.match(regexp, msg || `check that text list match: ${this.locator()}`);
            }
        },

        async checkListNotMatch(regexp, msg, lowerCase) {
            if (lowerCase) {
                (await this.getTextListLowerCase()).should.not.match(regexp, msg || `check list not match: ` + this.locator());
            } else {
                (await this.getTextList()).should.not.match(regexp, msg || `check list not match: ` + this.locator());
            }
        },

        async checkSortAscending(compareFn, limit) {
            await this.getTextListLimit(limit).then((unSorted) => {
                unSorted = unSorted.filter(Boolean);
                let sorted = unSorted.slice();
                sorted = compareFn ? sorted.sort(compareFn) : sorted.sort();
                sorted.should.deep.equal(unSorted, `check Ascending`);
            });
        },

        async checkSortDescending(compareFn, limit) {
            await this.getTextListLimit(limit).then((unSorted) => {
                unSorted = unSorted.filter(Boolean);
                let sorted = unSorted.slice();
                sorted = compareFn ? sorted.sort(compareFn) : sorted.sort();
                sorted.reverse().should.deep.equal(unSorted, `check Descending`);
            });
        },

        async checkTextMatch(regexp) {
            await this.map(async (elm) => {
                await elm.getText().then((val) => {
                    // console.log(val.trim());
                    val.should.match(regexp);
                });
            });
        }

    });
})();


text:
package io.polyglotted.eswrapper.services;

import io.polyglotted.eswrapper.AbstractElasticTest;
import io.polyglotted.eswrapper.indexing.Bundling;
import io.polyglotted.eswrapper.indexing.IndexSetting;
import io.polyglotted.eswrapper.indexing.Indexable;
import io.polyglotted.pgmodel.search.IndexKey;
import io.polyglotted.pgmodel.search.SimpleDoc;
import io.polyglotted.pgmodel.search.query.QueryResponse;
import org.testng.annotations.Test;

import java.util.List;

import static io.polyglotted.eswrapper.indexing.Bundling.bundlingBuilder;
import static io.polyglotted.eswrapper.indexing.IndexRecord.createRecord;
import static io.polyglotted.eswrapper.indexing.IndexSerializer.GSON;
import static io.polyglotted.eswrapper.indexing.Indexable.indexableBuilder;
import static io.polyglotted.eswrapper.indexing.TypeMapping.typeBuilder;
import static io.polyglotted.eswrapper.query.ResultBuilder.SimpleDocBuilder;
import static io.polyglotted.eswrapper.query.ResultBuilder.SimpleObjectBuilder;
import static io.polyglotted.eswrapper.services.Portfolio.FieldAddress;
import static io.polyglotted.eswrapper.services.Portfolio.PORTFOLIO_TYPE;
import static io.polyglotted.eswrapper.services.Trade.TRADE_TYPE;
import static io.polyglotted.eswrapper.services.Trade.trade;
import static io.polyglotted.pgmodel.search.IndexKey.keyWithParent;
import static io.polyglotted.pgmodel.search.index.FieldMapping.notAnalyzedStringField;
import static io.polyglotted.pgmodel.search.query.Expressions.equalsTo;
import static io.polyglotted.pgmodel.search.query.Expressions.hasChild;
import static io.polyglotted.pgmodel.search.query.Expressions.hasParent;
import static io.polyglotted.pgmodel.search.query.Expressions.in;
import static io.polyglotted.pgmodel.search.query.StandardQuery.queryBuilder;
import static java.util.Arrays.asList;
import static java.util.Collections.singleton;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class ParentChildTest extends AbstractElasticTest {
    private static final String PC_INDEX = "parent_child_index";

    @Override
    protected void performSetup() {
        admin.dropIndex(PC_INDEX);
        admin.createIndex(IndexSetting.with(3, 0), PC_INDEX);
        admin.createType(typeBuilder().index(PC_INDEX).type(PORTFOLIO_TYPE)
           .fieldMapping(notAnalyzedStringField(FieldAddress)).build());
        admin.createType(typeBuilder().index(PC_INDEX).type(TRADE_TYPE).parent(PORTFOLIO_TYPE)
           .fieldMapping(notAnalyzedStringField(FieldAddress)).build());
    }

    @Test
    public void writeParentChildRequest() {
        long timestamp = 1425494500000L;
        Portfolio portfolio = new Portfolio("/portfolios/1st", "first portfolio");
        Trade trade = trade("trades:001", "EMEA", "UK", "London", "IEU", "Alex", 1425427200000L, 20.0);
        Indexable indexable = indexableBuilder().timestamp(timestamp).user("unit-tester").records(asList(
           createRecord(PC_INDEX, PORTFOLIO_TYPE, portfolio.address).source(GSON.toJson(portfolio)).build(),
           createRecord(keyWithParent(PC_INDEX, TRADE_TYPE, trade.address, portfolio.address)).source(GSON.toJson(trade)).build()
        )).build();
        List<IndexKey> indexKeys = indexer.twoPhaseCommit(indexable);
        assertThat(query.findAll(indexKeys).size(), is(2));

        ensureHasParent(portfolio, trade);
        ensureHasChild(portfolio, trade);
        ensureBothDocs(2, portfolio.address, trade.address);
    }

    @Test
    public void childWithoutParentTest() {
        long timestamp = 1425495500000L;
        Trade trade = trade("trades:001", "EMEA", "UK", "London", "IEU", "Alex", 1425427200000L, 20.0);
        Bundling bundling = bundlingBuilder().timestamp(timestamp).records(singleton(
           createRecord(keyWithParent(PC_INDEX, TRADE_TYPE, "portfolios/2"))
              .source(GSON.toJson(trade)).build())).build();
        indexer.bulkIndex(bundling);

        ensureBothDocs(1, trade.address);
    }

    private void ensureHasParent(Portfolio portfolio, Trade trade) {
        QueryResponse response = query.search(queryBuilder().index(PC_INDEX)
              .expression(hasParent(PORTFOLIO_TYPE, equalsTo(FieldAddress, portfolio.address))).build(),
           null, SimpleObjectBuilder(GSON, Trade.class));
        List<Trade> simpleDocs = response.resultsAs(Trade.class);
        assertThat(simpleDocs.size(), is(1));
        assertThat(simpleDocs.get(0), is(trade));
    }

    private void ensureHasChild(Portfolio portfolio, Trade trade) {
        QueryResponse response = query.search(queryBuilder().index(PC_INDEX)
              .expression(hasChild(TRADE_TYPE, equalsTo(FieldAddress, trade.address))).build(),
           null, SimpleObjectBuilder(GSON, Portfolio.class));
        List<Portfolio> simpleDocs = response.resultsAs(Portfolio.class);
        assertThat(simpleDocs.size(), is(1));
        assertThat(simpleDocs.get(0), is(portfolio));
    }

    private void ensureBothDocs(int expected, String... addresses) {
        QueryResponse response = query.search(queryBuilder().index(PC_INDEX)
              .expression(in(FieldAddress, addresses)).build(),
           null, SimpleDocBuilder);
        List<SimpleDoc> simpleDocs = response.resultsAs(SimpleDoc.class);
        assertThat(simpleDocs.size(), is(expected));
    }
}


text:
<!DOCTYPE html>

<wicket:panel>
    <wicket:enclosure child="menuItem">

    </wicket:enclosure>
</wicket:panel>


text:
module Autolinker
  def autolink(input)
    input ||= ''
    site = @context.registers[:site]
    # at this point we have no more markdown but only html
    input.gsub(/\[([^\]]+)\]/) do |match|
      tokens = $1.split(',')
      raise "Forbidden match #{match}" unless tokens.size.between?(1, 2)
      target_post_title = tokens.pop.gsub('&','and')
      overriding_text = tokens.pop
      slugified_target_post_title = Jekyll::Utils.slugify(target_post_title)
      Jekyll.logger.debug "Looking for page with slug #{slugified_target_post_title.inspect}"
      target_post = site.posts.docs.find do |p|
        p.slug == slugified_target_post_title
      end
      raise "No internal page match found for #{match}" unless target_post
      anchor_text = overriding_text || target_post.title
      Jekyll.logger.debug "Auto-linking to #{target_post.url}"
      "#{anchor_text}"
    end
  end
end

Liquid::Template.register_filter(Autolinker)


text:
package org.basex.util.ft;

/**
 * Internal stemmer implementation.
 * The names of the implementations
 *
 * @author BaseX Team 2005-16, BSD License
 * @author Christian Gruen
 */
abstract class InternalStemmer extends Stemmer {
  /**
   * Constructor.
   * @param fti full-text iterator
   */
  InternalStemmer(final FTIterator fti) {
    super(fti);
  }

  @Override
  protected final byte prec() {
    return 10;
  }

  @Override
  public final String toString() {
    return "Internal";
  }
}


text:
from authlib.common.security import generate_token
from authlib.integrations.flask_oauth2 import AuthorizationServer

from indico.core.oauth.endpoints import IndicoIntrospectionEndpoint, IndicoRevocationEndpoint
from indico.core.oauth.grants import IndicoAuthorizationCodeGrant, IndicoCodeChallenge
from indico.core.oauth.protector import IndicoAuthlibHTTPError, IndicoBearerTokenValidator, IndicoResourceProtector
from indico.core.oauth.scopes import SCOPES
from indico.core.oauth.util import TOKEN_PREFIX_OAUTH, query_client, save_token

auth_server = AuthorizationServer(query_client=query_client, save_token=save_token)
require_oauth = IndicoResourceProtector()

def setup_oauth_provider(app):
    app.config.update({
        'OAUTH2_SCOPES_SUPPORTED': list(SCOPES),
        'OAUTH2_ACCESS_TOKEN_GENERATOR': lambda *args, **kw: TOKEN_PREFIX_OAUTH + generate_token(42),
        'OAUTH2_TOKEN_EXPIRES_IN': {
            'authorization_code': 0,
        }
    })
    app.register_error_handler(IndicoAuthlibHTTPError, lambda exc: exc.get_response())
    auth_server.init_app(app)
    auth_server.register_grant(IndicoAuthorizationCodeGrant, [IndicoCodeChallenge(required=True)])
    auth_server.register_endpoint(IndicoIntrospectionEndpoint)
    auth_server.register_endpoint(IndicoRevocationEndpoint)
    require_oauth.register_token_validator(IndicoBearerTokenValidator())


text:
            <form name="details" ng-submit="publish()">
                <button type="submit" class="btn btn-success submitBtn animate-show" ng-hide="details.$pristine"> Publish Changes</button>

                    Post Title
                    <input type="text" ng-model="page.title" class="form-control">

                    Post URL
                    <input type="text" ng-model="page.url" class="form-control">

                    Meta Description
                    <input type="text" ng-model="page.metaDescription" class="form-control">

                    Meta Key Words
                    <input type="text" ng-model="page.metaKeywords" class="form-control">

                    Post Body
                    <text-angular ng-model="page.pageHtml" ng-if="!loading"></text-angular>

                    Catagories
                    <tags-input ng-model="orgs.catagories" placeholder="Add a Category" add-on-paste="true" replace-spaces-with-dashes="false" on-tag-added="exists($tag, 'blogCatagories')">
                        <auto-complete
                            source="queryCats($query)"
                            max-results-to-show="32"
                            load-on-focus="true"
                            load-on-empty="true">
                        </auto-complete>
                    </tags-input>
                    {{cat.text}}

                    Tags
                    <tags-input ng-model="orgs.tags" placeholder="Add a Tag" add-on-paste="true" replace-spaces-with-dashes="false" on-tag-added="exists($tag, 'blogTags')">
                        <auto-complete
                            source="queryTags($query)"
                            max-results-to-show="32"
                            load-on-focus="true"
                            load-on-empty="true">
                        </auto-complete>
                    </tags-input>
                    {{cat.text}}

                    <button type="submit" class="btn btn-success animate-show pull-right" ng-hide="details.$pristine"> Publish Changes</button>
                    <button type="button" ng-click="delete()" class="btn btn-default btn-xs">Delete Post</button>

            </form>


text:
'''NeuroM neuron checking functions.

Contains functions for checking validity of neuron neurites and somata.
Tests assumes neurites and/or soma have been succesfully built where applicable,
i.e. soma- and neurite-related structural tests pass.
'''
from itertools import chain, islice

import numpy as np

from neurom import NeuriteType
from neurom._compat import zip
from neurom.check import CheckResult
from neurom.check.morphtree import get_flat_neurites, get_nonmonotonic_neurites
from neurom.core import Tree, iter_neurites, iter_sections, iter_segments
from neurom.core.dataformat import COLS
from neurom.fst import _neuritefunc as _nf
from neurom.morphmath import section_length, segment_length

def _read_neurite_type(neurite):
    '''Simply read the stored neurite type'''
    return neurite.type

def has_axon(neuron, treefun=_read_neurite_type):
    '''Check if a neuron has an axon

    Arguments:
        neuron(Neuron): The neuron object to test
        treefun: Optional function to calculate the tree type of
        neuron's neurites

    Returns:
        CheckResult with result
    '''
    return CheckResult(NeuriteType.axon in (treefun(n) for n in neuron.neurites))

def has_apical_dendrite(neuron, min_number=1, treefun=_read_neurite_type):
    '''Check if a neuron has apical dendrites

    Arguments:
        neuron(Neuron): The neuron object to test
        min_number: minimum number of apical dendrites required
        treefun: Optional function to calculate the tree type of neuron's
        neurites

    Returns:
        CheckResult with result
    '''
    types = [treefun(n) for n in neuron.neurites]
    return CheckResult(types.count(NeuriteType.apical_dendrite) >= min_number)

def has_basal_dendrite(neuron, min_number=1, treefun=_read_neurite_type):
    '''Check if a neuron has basal dendrites

    Arguments:
        neuron(Neuron): The neuron object to test
        min_number: minimum number of basal dendrites required
        treefun: Optional function to calculate the tree type of neuron's
        neurites

    Returns:
        CheckResult with result
    '''
    types = [treefun(n) for n in neuron.neurites]
    return CheckResult(types.count(NeuriteType.basal_dendrite) >= min_number)

def has_no_flat_neurites(neuron, tol=0.1, method='ratio'):
    '''Check that a neuron has no flat neurites

    Arguments:
        neuron(Neuron): The neuron object to test
        tol(float): tolerance
        method(string): way of determining flatness, 'tolerance', 'ratio' \
        as described in :meth:`neurom.check.morphtree.get_flat_neurites`

    Returns:
        CheckResult with result
    '''
    return CheckResult(len(get_flat_neurites(neuron, tol, method)) == 0)

def has_all_monotonic_neurites(neuron, tol=1e-6):
    '''Check that a neuron has only neurites that are monotonic

    Arguments:
        neuron(Neuron): The neuron object to test
        tol(float): tolerance

    Returns:
        CheckResult with result
    '''
    return CheckResult(len(get_nonmonotonic_neurites(neuron, tol)) == 0)

def has_all_nonzero_segment_lengths(neuron, threshold=0.0):
    '''Check presence of neuron segments with length not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold(float): value above which a segment length is considered to
        be non-zero

    Returns:
        CheckResult with result including list of (section_id, segment_id)
        of zero length segments
    '''
    bad_ids = []
    for sec in _nf.iter_sections(neuron):
        p = sec.points
        for i, s in enumerate(zip(p[:-1], p[1:])):
            if segment_length(s) <= threshold:
                bad_ids.append((sec.id, i))

    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_all_nonzero_section_lengths(neuron, threshold=0.0):
    '''Check presence of neuron sections with length not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold(float): value above which a section length is considered
        to be non-zero

    Returns:
        CheckResult with result including list of ids of bad sections
    '''
    bad_ids = [s.id for s in _nf.iter_sections(neuron.neurites)
               if section_length(s.points) <= threshold]

    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_all_nonzero_neurite_radii(neuron, threshold=0.0):
    '''Check presence of neurite points with radius not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold: value above which a radius is considered to be non-zero

    Returns:
        CheckResult with result including list of (section ID, point ID) pairs
        of zero-radius points
    '''
    bad_ids = []
    seen_ids = set()
    for s in _nf.iter_sections(neuron):
        for i, p in enumerate(s.points):
            info = (s.id, i)
            if p[COLS.R] <= threshold and info not in seen_ids:
                seen_ids.add(info)
                bad_ids.append(info)

    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_nonzero_soma_radius(neuron, threshold=0.0):
    '''Check if soma radius not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold: value above which the soma radius is considered to be non-zero

    Returns:
        CheckResult with result
    '''
    return CheckResult(neuron.soma.radius > threshold)

def has_no_jumps(neuron, max_distance=30.0, axis='z'):
    '''Check if there are jumps (large movements in the `axis`)

    Arguments:
        neuron(Neuron): The neuron object to test
        max_distance(float): value above which consecutive z-values are
        considered a jump
        axis(str): one of x/y/z, which axis to check for jumps

    Returns:
        CheckResult with result list of ids of bad sections
    '''
    bad_ids = []
    axis = {'x': COLS.X, 'y': COLS.Y, 'z': COLS.Z, }[axis.lower()]
    for neurite in iter_neurites(neuron):
        section_segment = ((sec, seg) for sec in iter_sections(neurite)
                           for seg in iter_segments(sec))
        for sec, (p0, p1) in islice(section_segment, 1, None):  # Skip neurite root segment
            if max_distance < abs(p0[axis] - p1[axis]):
                bad_ids.append((sec.id, [p0, p1]))
    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_no_fat_ends(neuron, multiple_of_mean=2.0, final_point_count=5):
    '''Check if leaf points are too large

    Arguments:
        neuron(Neuron): The neuron object to test
        multiple_of_mean(float): how many times larger the final radius
        has to be compared to the mean of the final points
        final_point_count(int): how many points to include in the mean

    Returns:
        CheckResult with result list of ids of bad sections

    Note:
        A fat end is defined as a leaf segment whose last point is larger
        by a factor of `multiple_of_mean` than the mean of the points in
        `final_point_count`
    '''
    bad_ids = []
    for leaf in _nf.iter_sections(neuron.neurites, iterator_type=Tree.ileaf):
        mean_radius = np.mean(leaf.points[1:][-final_point_count:, COLS.R])

        if mean_radius * multiple_of_mean <= leaf.points[-1, COLS.R]:
            bad_ids.append((leaf.id, leaf.points[-1:]))

    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_no_narrow_start(neuron, frac=0.9):
    '''Check if neurites have a narrow start

    Arguments:
        neuron(Neuron): The neuron object to test
        frac(float): Ratio that the second point must be smaller than the first

    Returns:
        CheckResult with a list of all first segments of neurites with a narrow start
    '''
    bad_ids = [(neurite.root_node.id, [neurite.root_node.points[1]])
               for neurite in neuron.neurites
               if neurite.root_node.points[1][COLS.R] < frac * neurite.root_node.points[2][COLS.R]]
    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_no_dangling_branch(neuron):
    '''Check if the neuron has dangling neurites'''
    soma_center = neuron.soma.points[:, COLS.XYZ].mean(axis=0)
    recentered_soma = neuron.soma.points[:, COLS.XYZ] - soma_center
    radius = np.linalg.norm(recentered_soma, axis=1)
    soma_max_radius = radius.max()

    def is_dangling(neurite):
        '''Is the neurite dangling ?'''
        starting_point = neurite.points[1][COLS.XYZ]

        if np.linalg.norm(starting_point - soma_center) - soma_max_radius <= 12.:
            return False

        if neurite.type != NeuriteType.axon:
            return True

        all_points = list(chain.from_iterable(n.points[1:]
                                              for n in iter_neurites(neurite)
                                              if n.type != NeuriteType.axon))
        res = [np.linalg.norm(starting_point - p[COLS.XYZ]) >= 2 * p[COLS.R] + 2
               for p in all_points]
        return all(res)

    bad_ids = [(n.root_node.id, [n.root_node.points[1]])
               for n in iter_neurites(neuron) if is_dangling(n)]
    return CheckResult(len(bad_ids) == 0, bad_ids)

def has_no_narrow_neurite_section(neuron,
                                  neurite_filter,
                                  radius_threshold=0.05,
                                  considered_section_min_length=50):
    '''Check if the neuron has dendrites with narrow sections

    Arguments:
        neuron(Neuron): The neuron object to test
        neurite_filter(callable): filter the neurites by this callable
        radius_threshold(float): radii below this are considered narro
        considered_section_min_length(float): sections with length below
        this are not taken into account

    Returns:
        CheckResult with result. result.info contains the narrow section ids and their
        first point
    '''

    considered_sections = (sec for sec in iter_sections(neuron, neurite_filter=neurite_filter)
                           if sec.length > considered_section_min_length)

    def narrow_section(section):
        '''Select narrow sections'''
        return section.points[:, COLS.R].mean() < radius_threshold

    bad_ids = [(section.id, section.points[1])
               for section in considered_sections if narrow_section(section)]
    return CheckResult(len(bad_ids) == 0, bad_ids)


text:
{-# LANGUAGE FlexibleContexts #-}

-- |
-- Module      : Database.HDBC.RecordJoin
-- Copyright   : 2013 Kei Hibino
-- License     : BSD3
--
-- Maintainer  : ex8k.hibino@gmail.com
-- Stability   : experimental
-- Portability : unknown
module Database.HDBC.RecordJoin (
  Record, unRecord, record,

  RecordFromSql, runTakeRecord,
  createRecordFromSql,

  recordDeSerializer,

  (<&>),

  PrimaryKey, definePrimaryKey, leftPrimaryKey, index,

  HasPrimaryKey (primaryKey),

  outer,

  FromSql (recordFromSql),
  takeRecord, takeSimpleRecord,
  toRecord, toSimpleRecord,

  RecordToSql, fromRecord,
  createRecordToSql,

  recordSerializer,

  ToSql (recordToSql),

  updateValues',
  updateValues
  ) where

import Database.HDBC.Persistable
  (PersistableRecord, Persistable, persistable)
import qualified Database.HDBC.Persistable as Persistable

import Database.HDBC (SqlValue(SqlNull))
import Control.Monad (liftM, ap)
import Control.Applicative ((<$>), Applicative(pure, (<*>)))

newtype Record a = Record { unRecord :: a } deriving (Show, Read, Eq)

record :: a -> Record a
record = Record

newtype RecordFromSql a =
  RecordFromSql
  { runTakeRecord :: [SqlValue] -> (a, [SqlValue]) }

createRecordFromSql' :: ([SqlValue] -> (a, [SqlValue])) -> RecordFromSql a
createRecordFromSql' =  RecordFromSql

createRecordFromSql :: ([SqlValue] -> (a, [SqlValue])) -> RecordFromSql (Record a)
createRecordFromSql takeF = createRecordFromSql' takeF'  where
  takeF' vals = let (a, vals') = takeF vals
               in  (record a, vals')

recordDeSerializer :: PersistableRecord a -> RecordFromSql (Record a)
recordDeSerializer =  createRecordFromSql . Persistable.takeRecord

instance Monad RecordFromSql where
  return a = createRecordFromSql' ((,) a)
  ma >>= fmb =
    createRecordFromSql' (\vals ->
                           let (a, vals') = runTakeRecord ma vals
                           in  runTakeRecord (fmb a) vals')

instance Functor RecordFromSql where
  fmap = liftM

instance Applicative RecordFromSql where
  pure  = return
  (<*>) = ap

(<&>) :: RecordFromSql a -> RecordFromSql b -> RecordFromSql (a, b)
a <&> b = (,) <$> a <*> b

infixl 4 <&>

newtype PrimaryKey a = PrimaryKey { index :: Int }

definePrimaryKey :: Int -> PrimaryKey a
definePrimaryKey = PrimaryKey

leftPrimaryKey :: PrimaryKey a -> PrimaryKey (a, b)
leftPrimaryKey pa = definePrimaryKey (index pa)

outer :: RecordFromSql a -> PrimaryKey a -> RecordFromSql (Maybe a)
outer rec pkey = createRecordFromSql' mayToRec where
  mayToRec vals
    | vals !! index pkey /= SqlNull = (Just a,  vals')
    | otherwise                     = (Nothing, vals')  where
      (a, vals') = runTakeRecord rec vals

class FromSql a where
  recordFromSql :: RecordFromSql a

instance Persistable a => FromSql (Record a)  where
  recordFromSql = recordDeSerializer persistable

instance (FromSql a, FromSql b) => FromSql (a, b)  where
  recordFromSql = recordFromSql <&> recordFromSql

class HasPrimaryKey a where
  primaryKey :: PrimaryKey a

instance HasPrimaryKey a => HasPrimaryKey (a, b) where
  primaryKey = leftPrimaryKey primaryKey

instance (HasPrimaryKey a, FromSql a) => FromSql (Maybe a) where
  recordFromSql = outer recordFromSql $ primaryKey

takeRecord :: FromSql a => [SqlValue] -> (a, [SqlValue])
takeRecord =  runTakeRecord recordFromSql

takeSimpleRecord :: FromSql (Record a) => [SqlValue] -> (a, [SqlValue])
takeSimpleRecord vals = (unRecord ra, vals')  where
  (ra, vals') = takeRecord vals

toRecord :: FromSql a => [SqlValue] -> a
toRecord = fst . takeRecord

toSimpleRecord :: FromSql (Record a) => [SqlValue] -> a
toSimpleRecord =  unRecord . toRecord

data RecordToSql a =
  RecordToSql
  { fromRecord :: a -> [SqlValue] }

createRecordToSql' :: (a -> [SqlValue]) -> RecordToSql a
createRecordToSql' =  RecordToSql

createRecordToSql :: (a -> [SqlValue]) -> RecordToSql (Record a)
createRecordToSql packF = createRecordToSql' (packF . unRecord)

recordSerializer :: PersistableRecord a -> RecordToSql (Record a)
recordSerializer =  createRecordToSql . Persistable.fromRecord

class ToSql a where
  recordToSql :: RecordToSql a

instance Persistable a => ToSql (Record a) where
  recordToSql = recordSerializer persistable

updateValues' :: RecordToSql ra
              -> PrimaryKey ra
              -> ra
              -> [SqlValue]
updateValues' pr pk a = hd ++ tl  where
  (hd, _pk:tl) = splitAt (index pk) (fromRecord pr a)

updateValues :: (HasPrimaryKey (Record a), ToSql (Record a)) =>
                a -> [SqlValue]
updateValues = updateValues' recordToSql primaryKey . record


text:
class FileUpload::Create < Mutations::Command
  required do
    file    :file
    model   :uploadable, class: ActiveRecord::Base
    model   :uploader, class: User
    symbol  :upload_type, default: :file, in: %i(file profile_picture sponsor_image)
    boolean :is_public
  end

  optional do
    string :name, empty: true, nils: true
  end

  def execute
    file_name = file.original_filename || File.basename(file.path)

    upload = FileUpload.new
    upload.id = SecureRandom.uuid

    upload.name        = name.present? ? name : File.basename(file_name, '.*')
    upload.upload_type = upload_type
    upload.uploadable  = uploadable
    upload.uploader    = uploader
    upload.is_public   = is_public

    encrypted = Crypto::Encryptor.new.process(file.read)

    upload.file_encryption_details = encrypted.details

    upload.file_name         = file_name
    upload.file_size_bytes   = file.size
    upload.file_path         = "file_uploads/#{upload.id}"
    upload.file_content_type = ::MIME::Types.type_for(file.path).first.to_s
    upload.file_extension    = File.extname(file.path)

    FileUpload.directory.files.create({
      :body         => encrypted.data,
      :key          => upload.file_path,
      :public       => false
    })

    upload.save!
    upload
  end
end


text:
@interface DataEntryImgPicCell : UICollectionViewCell
@property (nonatomic, assign) BOOL isLast;
@property (nonatomic, strong) UIImage *img;
@property (nonatomic, copy) void (^deleteImg)(); //删除对应图片
@end


text:
This is repository contains a set of tests to show different features of drools.

Building
This is a maven project, to run it, just execute mvn clean install


text:
@ExportPackage
package com.yahoo.searchlib.expression;

import com.yahoo.osgi.annotation.ExportPackage;


text:
<script
	src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<!-- include bootstrap compiled plugins -->
<script src="/js/bootstrap.min.js"></script>

<!-- include vendelligence utilities script -->
<script src="/js/vendelligence-utilities.js"></script>


text:
<?php namespace Config;

class Request
{

	private $controller;
	private $method;
	private $params;

	public function __construct()
	{
		if(isset($_GET['url'])){
			$route = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL);
			$route = explode("/", $route);
			$route = array_filter($route);
			if($route[0] == "index.php"){
				$this->controller = "home";
			}else{
				$this->controller = strtolower(array_shift($route));
			}

			$this->method = strtolower(array_shift($route));

			if(!$this->method){
				$this->method = "index";
			}
			$this->params = $route;
		}else{
			$this->controller = "home";
			$this->method = "index";
		}
	}

	public function getController()
	{
		return $this->controller;
	}

	public function getMethod()
	{
		return $this->method;
	}

	public function getParams()
	{
		return $this->params;
	}
}


text:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { Routes, RouterModule } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './root/app.component';
import { Page1Component } from './page1/page1.component';

import { Page1Service } from './page1/page1.service';

import { Dispatcher, AsyncStatePipe, InitialState } from '../../angular-rxjs-redux';
import { Store, State, FirebaseEffector, defaultAppState } from './store';

const appRoutes: Routes = [
  {
    path: '',
    redirectTo: '/page1',
    pathMatch: 'full'
  },
  { path: 'page1', component: Page1Component }
];

@NgModule({
  imports: [BrowserModule, RouterModule.forRoot(appRoutes), FormsModule, HttpModule],
  declarations: [AppComponent, Page1Component, AsyncStatePipe],
  providers: [
    Dispatcher, Store, State, Page1Service,
    FirebaseEffector,
    { provide: InitialState, useValue: defaultAppState },
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }


text:
package oam

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

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

// AddRoleToRole invokes the oam.AddRoleToRole API synchronously
// api document: https://help.aliyun.com/api/oam/addroletorole.html
func (client *Client) AddRoleToRole(request *AddRoleToRoleRequest) (response *AddRoleToRoleResponse, err error) {
	response = CreateAddRoleToRoleResponse()
	err = client.DoAction(request, response)
	return
}

// AddRoleToRoleWithChan invokes the oam.AddRoleToRole API asynchronously
// api document: https://help.aliyun.com/api/oam/addroletorole.html
// asynchronous document: https://help.aliyun.com/document_detail/66220.html
func (client *Client) AddRoleToRoleWithChan(request *AddRoleToRoleRequest) (<-chan *AddRoleToRoleResponse, <-chan error) {
	responseChan := make(chan *AddRoleToRoleResponse, 1)
	errChan := make(chan error, 1)
	err := client.AddAsyncTask(func() {
		defer close(responseChan)
		defer close(errChan)
		response, err := client.AddRoleToRole(request)
		if err != nil {
			errChan <- err
		} else {
			responseChan <- response
		}
	})
	if err != nil {
		errChan <- err
		close(responseChan)
		close(errChan)
	}
	return responseChan, errChan
}

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

// AddRoleToRoleRequest is the request struct for api AddRoleToRole
type AddRoleToRoleRequest struct {
	*requests.RpcRequest
	RoleName     string `position:"Query" name:"RoleName"`
	BaseRoleName string `position:"Query" name:"BaseRoleName"`
}

// AddRoleToRoleResponse is the response struct for api AddRoleToRole
type AddRoleToRoleResponse struct {
	*responses.BaseResponse
	Code    string `json:"Code" xml:"Code"`
	Message string `json:"Message" xml:"Message"`
}

// CreateAddRoleToRoleRequest creates a request to invoke AddRoleToRole API
func CreateAddRoleToRoleRequest() (request *AddRoleToRoleRequest) {
	request = &AddRoleToRoleRequest{
		RpcRequest: &requests.RpcRequest{},
	}
	request.InitWithApiInfo("Oam", "2017-01-01", "AddRoleToRole", "", "")
	request.Method = requests.POST
	return
}

// CreateAddRoleToRoleResponse creates a response to parse from AddRoleToRole response
func CreateAddRoleToRoleResponse() (response *AddRoleToRoleResponse) {
	response = &AddRoleToRoleResponse{
		BaseResponse: &responses.BaseResponse{},
	}
	return
}


text:
require 'will_paginate'

=begin How to Use the Grades Entry Form Pagination Helper
hash requires:
  :model              * the type of data that needs pagination
  :per_pages          * an array of integers, each integer representing
                        a selection of pagination size for the user
  :filters            * a list of possible filters that can be applied
                        to the data of type :model
    a name for each filter
      :display        * the text the user sees
      :proc => lambda * the processing done to each instance of the :model
  :sorts
    for each sort
    "name"            * the string that will appear in the URL of a GET
                        or AJAX request
      => lambda       * the lambda expression that handles the sorting
=end
module GradeEntryFormsPaginationHelper
  # For the hash that's passed to handle_ap_event, these are the required
  # fields.
  AP_REQUIRED_KEYS = [:model, :filters]
  AP_DEFAULT_PER_PAGE = 30
  AP_DEFAULT_PAGE = 1

  def handle_paginate_event(hash, object_hash, params)
    # First, let's make sure we have the required fields.
    # I'll take the keys from the hash, and difference it from
    # the AP_REQUIRED_FIELDS.  If there are any symbols left over
    # in the difference, the hash wasn't complete, and we should bail out.
    if (AP_REQUIRED_KEYS - hash.keys).size > 0
     # Fail loud, fail proud
      raise 'handle_paginate_event received an incomplete parameter hash'
    end
    # Ok, we have everything we need, let's get to work
    filter = params[:filter]
    desc = params[:desc]
    sorts = hash[:sorts]
    filters = hash[:filters]
    unless filters.include?(filter)
      raise "Could not find filter #{filter}"
    end
    items = get_filtered_items(hash, filter, params[:sort_by], desc)
    if params[:per_page].blank?
      params[:per_page] = AP_DEFAULT_PER_PAGE
    end
    if params[:page].blank?
      params[:page] = AP_DEFAULT_PAGE
    end

    return items.paginate(per_page: params[:per_page], page: params[:page]).clone, items.size

  end

  def get_filters(params)
    result = {}
    params[:filters].each do |filter_key, filter|
      result[filter[:display]] = filter_key
    end
    result
  end

  def get_filtered_items(hash, filter, sort_by, desc)
    if desc.present?
      order = 'DESC'
    else
      order = 'ASC'
    end

    hash[:filters][filter][:proc].call(sort_by, order, current_user)
  end

end


text:
using Kw.Combinatorics;
using System;
using System.Linq;

namespace Kw.CombinatoricsExamples
{
    class PnExample05
    {
        static void Main ()
        {
            // Create a k-permutation:

            var pn = new Permutation (choices:8, picks:4, rank:601);
            Console.WriteLine ("n={0}, k={1}, rank={2}:\n", pn.Choices, pn.Picks, pn.Rank);

            // Access elements using the default enumerator:

            var text = String.Concat (pn.Select (ei => (char) ('A' + ei)));
            Console.WriteLine (text + "\n");

            // Access elements using the indexer:

            for (int i = 0; i < pn.Picks; ++i)
                Console.WriteLine ("Element at {0} is {1}", i, pn[i]);
        }

        /* Output:

        n=8, k=4, rank=601:

        CHAD

        Element at 0 is 2
        Element at 1 is 7
        Element at 2 is 0
        Element at 3 is 3

        */
    }
}


text:
// Copyright 2020 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <gtest/gtest.h>

#include <functional>
#include <memory>
#include <string>
#include <utility>

// TODO(aprotyas): Figure out better way to suppress deprecation warnings.
#define RCLCPP_AVOID_DEPRECATIONS_FOR_UNIT_TESTS 1
#include "rclcpp/any_subscription_callback.hpp"
#include "test_msgs/msg/empty.hpp"
#include "test_msgs/msg/empty.h"

// Type adapter to be used in tests.
struct MyEmpty {};

template<>
struct rclcpp::TypeAdapter<MyEmpty, test_msgs::msg::Empty>
{
  using is_specialized = std::true_type;
  using custom_type = MyEmpty;
  using ros_message_type = test_msgs::msg::Empty;

  static
  void
  convert_to_ros_message(const custom_type &, ros_message_type &)
  {}

  static
  void
  convert_to_custom(const ros_message_type &, custom_type &)
  {}
};

using MyTA = rclcpp::TypeAdapter<MyEmpty, test_msgs::msg::Empty>;

class TestAnySubscriptionCallback : public ::testing::Test
{
public:
  TestAnySubscriptionCallback() {}

  static
  std::unique_ptr<test_msgs::msg::Empty>
  get_unique_ptr_msg()
  {
    return std::make_unique<test_msgs::msg::Empty>();
  }

protected:
  rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> any_subscription_callback_;
  std::shared_ptr<test_msgs::msg::Empty> msg_shared_ptr_{std::make_shared<test_msgs::msg::Empty>()};
  rclcpp::MessageInfo message_info_;
};

class TestAnySubscriptionCallbackTA : public ::testing::Test
{
public:
  TestAnySubscriptionCallbackTA() {}

  static
  std::unique_ptr<MyEmpty>
  get_unique_ptr_msg()
  {
    return std::make_unique<MyEmpty>();
  }

protected:
  rclcpp::AnySubscriptionCallback<MyEmpty> any_subscription_callback_;
  std::shared_ptr<MyEmpty> msg_shared_ptr_{std::make_shared<MyEmpty>()};
  rclcpp::MessageInfo message_info_;
};

TEST_F(TestAnySubscriptionCallback, construct_destruct) {
  // Default constructor.
  rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc1;

  // Constructor with allocator.
  std::allocator<void> allocator;
  rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc2(allocator);
}

TEST_F(TestAnySubscriptionCallback, is_serialized_message_callback) {
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](const rclcpp::SerializedMessage &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](const rclcpp::SerializedMessage &, const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](const rclcpp::SerializedMessage &, const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::unique_ptr<rclcpp::SerializedMessage>) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::unique_ptr<rclcpp::SerializedMessage>, const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::shared_ptr<const rclcpp::SerializedMessage>) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::shared_ptr<const rclcpp::SerializedMessage>, const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](const std::shared_ptr<const rclcpp::SerializedMessage> &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set(
      [](
        const std::shared_ptr<const rclcpp::SerializedMessage> &,
        const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::shared_ptr<rclcpp::SerializedMessage>) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
  {
    rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty> asc;
    asc.set([](std::shared_ptr<rclcpp::SerializedMessage>, const rclcpp::MessageInfo &) {});
    EXPECT_TRUE(asc.is_serialized_message_callback());
    EXPECT_NO_THROW(
      asc.dispatch(
        std::make_shared<rclcpp::SerializedMessage>(),
        rclcpp::MessageInfo{}));
  }
}

TEST_F(TestAnySubscriptionCallback, unset_dispatch_throw) {
  EXPECT_THROW(
    any_subscription_callback_.dispatch(msg_shared_ptr_, message_info_),
    std::runtime_error);
  EXPECT_THROW(
    any_subscription_callback_.dispatch_intra_process(msg_shared_ptr_, message_info_),
    std::runtime_error);
  EXPECT_THROW(
    any_subscription_callback_.dispatch_intra_process(get_unique_ptr_msg(), message_info_),
    std::runtime_error);
}

//
// Parameterized test to test across all callback types and dispatch types.
//

template<typename MessageT>
class InstanceContextImpl
{
public:
  InstanceContextImpl() = default;
  virtual ~InstanceContextImpl() = default;

  explicit InstanceContextImpl(rclcpp::AnySubscriptionCallback<MessageT> asc)
  : any_subscription_callback_(asc)
  {}

  virtual
  rclcpp::AnySubscriptionCallback<MessageT>
  get_any_subscription_callback_to_test() const
  {
    return any_subscription_callback_;
  }

protected:
  rclcpp::AnySubscriptionCallback<MessageT> any_subscription_callback_;
};

template<typename MessageT>
class InstanceContext
{
public:
  InstanceContext(const std::string & name, std::shared_ptr<InstanceContextImpl<MessageT>> impl)
  : name(name), impl_(impl)
  {}

  InstanceContext(
    const std::string & name,
    rclcpp::AnySubscriptionCallback<MessageT> asc)
  : name(name), impl_(std::make_shared<InstanceContextImpl<MessageT>>(asc))
  {}

  InstanceContext(const InstanceContext & other)
  : InstanceContext(other.name, other.impl_) {}

  rclcpp::AnySubscriptionCallback<MessageT>
  get_any_subscription_callback_to_test() const
  {
    return impl_->get_any_subscription_callback_to_test();
  }

  std::string name;

protected:
  std::shared_ptr<InstanceContextImpl<MessageT>> impl_;
};

class DispatchTests
  : public TestAnySubscriptionCallback,
  public ::testing::WithParamInterface<InstanceContext<test_msgs::msg::Empty>>
{};

class DispatchTestsWithTA
  : public TestAnySubscriptionCallbackTA,
  public ::testing::WithParamInterface<InstanceContext<MyTA>>
{};

auto
format_parameter(const ::testing::TestParamInfo<DispatchTests::ParamType> & info)
{
  return info.param.name;
}

auto
format_parameter_with_ta(const ::testing::TestParamInfo<DispatchTestsWithTA::ParamType> & info)
{
  return info.param.name;
}

/* Testing dispatch with shared_ptr<MessageT> as input */
TEST_P(DispatchTests, test_inter_shared_dispatch) {
  auto any_subscription_callback_to_test = GetParam().get_any_subscription_callback_to_test();
  any_subscription_callback_to_test.dispatch(msg_shared_ptr_, message_info_);
}

/* Testing dispatch with shared_ptr<const MessageT> as input */
TEST_P(DispatchTests, test_intra_shared_dispatch) {
  auto any_subscription_callback_to_test = GetParam().get_any_subscription_callback_to_test();
  any_subscription_callback_to_test.dispatch_intra_process(msg_shared_ptr_, message_info_);
}

/* Testing dispatch with unique_ptr<MessageT> as input */
TEST_P(DispatchTests, test_intra_unique_dispatch) {
  auto any_subscription_callback_to_test = GetParam().get_any_subscription_callback_to_test();
  any_subscription_callback_to_test.dispatch_intra_process(get_unique_ptr_msg(), message_info_);
}

/* Testing dispatch with shared_ptr<const MessageT> as input */
TEST_P(DispatchTestsWithTA, test_intra_shared_dispatch) {
  auto any_subscription_callback_to_test = GetParam().get_any_subscription_callback_to_test();
  any_subscription_callback_to_test.dispatch_intra_process(msg_shared_ptr_, message_info_);
}

/* Testing dispatch with unique_ptr<MessageT> as input */
TEST_P(DispatchTestsWithTA, test_intra_unique_dispatch) {
  auto any_subscription_callback_to_test = GetParam().get_any_subscription_callback_to_test();
  any_subscription_callback_to_test.dispatch_intra_process(get_unique_ptr_msg(), message_info_);
}

// Generic classes for testing callbacks using std::bind to class methods.
template<typename MessageT, typename ... CallbackArgs>
class BindContextImpl : public InstanceContextImpl<MessageT>
{
  static constexpr size_t number_of_callback_args{sizeof...(CallbackArgs)};

public:
  using InstanceContextImpl<MessageT>::InstanceContextImpl;
  virtual ~BindContextImpl() = default;

  void on_message(CallbackArgs ...) const {}

  rclcpp::AnySubscriptionCallback<MessageT>
  get_any_subscription_callback_to_test() const override
  {
    if constexpr (number_of_callback_args == 1) {
      return rclcpp::AnySubscriptionCallback<MessageT>().set(
        std::bind(&BindContextImpl::on_message, this, std::placeholders::_1)
      );
    } else {
      return rclcpp::AnySubscriptionCallback<MessageT>().set(
        std::bind(&BindContextImpl::on_message, this, std::placeholders::_1, std::placeholders::_2)
      );
    }
  }
};

template<typename MessageT, typename ... CallbackArgs>
class BindContext : public InstanceContext<MessageT>
{
public:
  explicit BindContext(const std::string & name)
  : InstanceContext<MessageT>(name, std::make_shared<BindContextImpl<MessageT, CallbackArgs ...>>())
  {}
};

//
// Versions of `const MessageT &`
//
void const_ref_free_func(const test_msgs::msg::Empty &) {}
void const_ref_w_info_free_func(const test_msgs::msg::Empty &, const rclcpp::MessageInfo &) {}

INSTANTIATE_TEST_SUITE_P(
  ConstRefCallbackTests,
  DispatchTests,
  ::testing::Values(
    // lambda
    InstanceContext{"lambda", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](const test_msgs::msg::Empty &) {})},
    InstanceContext{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](const test_msgs::msg::Empty &, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext{"free_function", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        const_ref_free_func)},
    InstanceContext{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        const_ref_w_info_free_func)},
    // bind function
    BindContext<test_msgs::msg::Empty, const test_msgs::msg::Empty &>("bind_method"),
    BindContext<test_msgs::msg::Empty, const test_msgs::msg::Empty &, const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter
);

void const_ref_ta_free_func(const MyEmpty &) {}
void const_ref_ta_w_info_free_func(const MyEmpty &, const rclcpp::MessageInfo &) {}

INSTANTIATE_TEST_SUITE_P(
  ConstRefTACallbackTests,
  DispatchTestsWithTA,
  ::testing::Values(
    // lambda
    InstanceContext<MyTA>{"lambda_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const MyEmpty &) {})},
    InstanceContext<MyTA>{"lambda_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const MyEmpty &, const rclcpp::MessageInfo &) {})},
    InstanceContext<MyTA>{"lambda", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const test_msgs::msg::Empty &) {})},
    InstanceContext<MyTA>{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const test_msgs::msg::Empty &, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext<MyTA>{"free_function_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_ta_free_func)},
    InstanceContext<MyTA>{"free_function_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_ta_w_info_free_func)},
    InstanceContext<MyTA>{"free_function", rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_free_func)},
    InstanceContext<MyTA>{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_w_info_free_func)},
    // bind function
    BindContext<MyTA, const MyEmpty &>("bind_method_ta"),
    BindContext<MyTA, const MyEmpty &, const rclcpp::MessageInfo &>(
      "bind_method_ta_with_info"),
    BindContext<MyTA, const test_msgs::msg::Empty &>("bind_method"),
    BindContext<MyTA, const test_msgs::msg::Empty &, const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter_with_ta
);

//
// Versions of `std::unique_ptr<MessageT, MessageDeleter>`
//
void unique_ptr_free_func(std::unique_ptr<test_msgs::msg::Empty>) {}
void unique_ptr_w_info_free_func(
  std::unique_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  UniquePtrCallbackTests,
  DispatchTests,
  ::testing::Values(
    // lambda
    InstanceContext{"lambda", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::unique_ptr<test_msgs::msg::Empty>) {})},
    InstanceContext{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::unique_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext{"free_function", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        unique_ptr_free_func)},
    InstanceContext{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        unique_ptr_w_info_free_func)},
    // bind function
    BindContext<test_msgs::msg::Empty, std::unique_ptr<test_msgs::msg::Empty>>("bind_method"),
    BindContext<
      test_msgs::msg::Empty,
      std::unique_ptr<test_msgs::msg::Empty>,
      const rclcpp::MessageInfo &
    >("bind_method_with_info")
  ),
  format_parameter
);

void unique_ptr_ta_free_func(std::unique_ptr<MyEmpty>) {}
void unique_ptr_ta_w_info_free_func(std::unique_ptr<MyEmpty>, const rclcpp::MessageInfo &) {}

INSTANTIATE_TEST_SUITE_P(
  UniquePtrCallbackTests,
  DispatchTestsWithTA,
  ::testing::Values(
    // lambda
    InstanceContext<MyTA>{"lambda_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::unique_ptr<MyEmpty>) {})},
    InstanceContext<MyTA>{"lambda_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::unique_ptr<MyEmpty>, const rclcpp::MessageInfo &) {})},
    InstanceContext<MyTA>{"lambda", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::unique_ptr<test_msgs::msg::Empty>) {})},
    InstanceContext<MyTA>{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::unique_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext<MyTA>{"free_function_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        unique_ptr_ta_free_func)},
    InstanceContext<MyTA>{"free_function_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        unique_ptr_ta_w_info_free_func)},
    InstanceContext<MyTA>{"free_function", rclcpp::AnySubscriptionCallback<MyTA>().set(
        unique_ptr_free_func)},
    InstanceContext<MyTA>{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        unique_ptr_w_info_free_func)},
    // bind function
    BindContext<MyTA, std::unique_ptr<test_msgs::msg::Empty>>("bind_method_ta"),
    BindContext<MyTA, std::unique_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &>(
      "bind_method_ta_with_info"),
    BindContext<MyTA, std::unique_ptr<test_msgs::msg::Empty>>("bind_method"),
    BindContext<MyTA, std::unique_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter_with_ta
);

//
// Versions of `std::shared_ptr<const MessageT>`
//
void shared_const_ptr_free_func(std::shared_ptr<const test_msgs::msg::Empty>) {}
void shared_const_ptr_w_info_free_func(
  std::shared_ptr<const test_msgs::msg::Empty>, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  SharedConstPtrCallbackTests,
  DispatchTests,
  ::testing::Values(
    // lambda
    InstanceContext{"lambda", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::shared_ptr<const test_msgs::msg::Empty>) {})},
    InstanceContext{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::shared_ptr<const test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext{"free_function", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        shared_const_ptr_free_func)},
    InstanceContext{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        shared_const_ptr_w_info_free_func)},
    // bind function
    BindContext<test_msgs::msg::Empty, std::shared_ptr<const test_msgs::msg::Empty>>("bind_method"),
    BindContext<test_msgs::msg::Empty, std::shared_ptr<const test_msgs::msg::Empty>,
    const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter
);

void shared_const_ptr_ta_free_func(std::shared_ptr<const MyEmpty>) {}
void shared_const_ptr_ta_w_info_free_func(
  std::shared_ptr<const MyEmpty>, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  SharedConstPtrCallbackTests,
  DispatchTestsWithTA,
  ::testing::Values(
    // lambda
    InstanceContext<MyTA>{"lambda_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<const MyEmpty>) {})},
    InstanceContext<MyTA>{"lambda_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<const MyEmpty>, const rclcpp::MessageInfo &) {})},
    InstanceContext<MyTA>{"lambda", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<const test_msgs::msg::Empty>) {})},
    InstanceContext<MyTA>{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<const test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext<MyTA>{"free_function_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_const_ptr_ta_free_func)},
    InstanceContext<MyTA>{"free_function_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_const_ptr_ta_w_info_free_func)},
    InstanceContext<MyTA>{"free_function", rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_const_ptr_free_func)},
    InstanceContext<MyTA>{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_const_ptr_w_info_free_func)},
    // bind function
    BindContext<MyTA, std::shared_ptr<const MyEmpty>>("bind_method_ta"),
    BindContext<MyTA, std::shared_ptr<const MyEmpty>, const rclcpp::MessageInfo &>(
      "bind_method_ta_with_info"),
    BindContext<MyTA, std::shared_ptr<const test_msgs::msg::Empty>>("bind_method"),
    BindContext<MyTA, std::shared_ptr<const test_msgs::msg::Empty>, const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter_with_ta
);

//
// Versions of `const std::shared_ptr<const MessageT> &`
//
void const_ref_shared_const_ptr_free_func(const std::shared_ptr<const test_msgs::msg::Empty> &) {}
void const_ref_shared_const_ptr_w_info_free_func(
  const std::shared_ptr<const test_msgs::msg::Empty> &, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  ConstRefSharedConstPtrCallbackTests,
  DispatchTests,
  ::testing::Values(
    // lambda
    InstanceContext{"lambda", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](const std::shared_ptr<const test_msgs::msg::Empty> &) {})},
    InstanceContext{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](const std::shared_ptr<const test_msgs::msg::Empty> &, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext{"free_function", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        const_ref_shared_const_ptr_free_func)},
    InstanceContext{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        const_ref_shared_const_ptr_w_info_free_func)},
    // bind function
    BindContext<test_msgs::msg::Empty,
    const std::shared_ptr<const test_msgs::msg::Empty> &>("bind_method"),
    BindContext<test_msgs::msg::Empty, const std::shared_ptr<const test_msgs::msg::Empty> &,
    const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter
);

void const_ref_shared_const_ptr_ta_free_func(const std::shared_ptr<const MyEmpty> &) {}
void const_ref_shared_const_ptr_ta_w_info_free_func(
  const std::shared_ptr<const MyEmpty> &, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  ConstRefSharedConstPtrCallbackTests,
  DispatchTestsWithTA,
  ::testing::Values(
    // lambda
    InstanceContext<MyTA>{"lambda_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const std::shared_ptr<const MyEmpty> &) {})},
    InstanceContext<MyTA>{"lambda_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const std::shared_ptr<const MyEmpty> &, const rclcpp::MessageInfo &) {})},
    InstanceContext<MyTA>{"lambda", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const std::shared_ptr<const test_msgs::msg::Empty> &) {})},
    InstanceContext<MyTA>{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](const std::shared_ptr<const test_msgs::msg::Empty> &, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext<MyTA>{"free_function_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_shared_const_ptr_ta_free_func)},
    InstanceContext<MyTA>{"free_function_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_shared_const_ptr_ta_w_info_free_func)},
    InstanceContext<MyTA>{"free_function", rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_shared_const_ptr_free_func)},
    InstanceContext<MyTA>{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        const_ref_shared_const_ptr_w_info_free_func)},
    // bind function
    BindContext<MyTA, const std::shared_ptr<const MyEmpty> &>("bind_method_ta"),
    BindContext<MyTA, const std::shared_ptr<const MyEmpty> &, const rclcpp::MessageInfo &>(
      "bind_method_ta_with_info"),
    BindContext<MyTA, const std::shared_ptr<const test_msgs::msg::Empty> &>("bind_method"),
    BindContext<MyTA, const std::shared_ptr<const test_msgs::msg::Empty> &,
    const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter_with_ta
);

//
// Versions of `std::shared_ptr<MessageT>`
//
void shared_ptr_free_func(std::shared_ptr<test_msgs::msg::Empty>) {}
void shared_ptr_w_info_free_func(
  std::shared_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  SharedPtrCallbackTests,
  DispatchTests,
  ::testing::Values(
    // lambda
    InstanceContext{"lambda", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::shared_ptr<test_msgs::msg::Empty>) {})},
    InstanceContext{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        [](std::shared_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext{"free_function", rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        shared_ptr_free_func)},
    InstanceContext{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<test_msgs::msg::Empty>().set(
        shared_ptr_w_info_free_func)},
    // bind function
    BindContext<test_msgs::msg::Empty, std::shared_ptr<test_msgs::msg::Empty>>("bind_method"),
    BindContext<test_msgs::msg::Empty, std::shared_ptr<test_msgs::msg::Empty>,
    const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter
);

void shared_ptr_ta_free_func(std::shared_ptr<MyEmpty>) {}
void shared_ptr_ta_w_info_free_func(
  std::shared_ptr<MyEmpty>, const rclcpp::MessageInfo &)
{}

INSTANTIATE_TEST_SUITE_P(
  SharedPtrCallbackTests,
  DispatchTestsWithTA,
  ::testing::Values(
    // lambda
    InstanceContext<MyTA>{"lambda_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<MyEmpty>) {})},
    InstanceContext<MyTA>{"lambda_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<MyEmpty>, const rclcpp::MessageInfo &) {})},
    InstanceContext<MyTA>{"lambda", rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<test_msgs::msg::Empty>) {})},
    InstanceContext<MyTA>{"lambda_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        [](std::shared_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &) {})},
    // free function
    InstanceContext<MyTA>{"free_function_ta", rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_ptr_ta_free_func)},
    InstanceContext<MyTA>{"free_function_ta_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_ptr_ta_w_info_free_func)},
    InstanceContext<MyTA>{"free_function", rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_ptr_free_func)},
    InstanceContext<MyTA>{"free_function_with_info",
      rclcpp::AnySubscriptionCallback<MyTA>().set(
        shared_ptr_w_info_free_func)},
    // bind function
    BindContext<MyTA, std::shared_ptr<MyEmpty>>("bind_method_ta"),
    BindContext<MyTA, std::shared_ptr<MyEmpty>, const rclcpp::MessageInfo &>(
      "bind_method_ta_with_info"),
    BindContext<MyTA, std::shared_ptr<test_msgs::msg::Empty>>("bind_method"),
    BindContext<MyTA, std::shared_ptr<test_msgs::msg::Empty>, const rclcpp::MessageInfo &>(
      "bind_method_with_info")
  ),
  format_parameter_with_ta
);


text:
class YardExtension < YARD::Handlers::Ruby::Base
  handles method_call(:hook)
  handles method_call(:configure)
  handles method_call(:request)
  handles method_call(:work)
  namespace_only

  def process
    name = statement.parameters.first.jump(:tstring_content, :ident).source
    case statement.method_name.source.to_sym
    when :hook, :work
      object = YARD::CodeObjects::MethodObject.new(namespace, "#{name}")
    when :configure, :request
      object = YARD::CodeObjects::MethodObject.new(namespace, "#{statement.method_name.source}_#{name}")
    end
    register(object)
    parse_block(statement.last.last, :owner => object)
    object.dynamic = true
  end
end


text:
package com.fasterxml.jackson.databind;

public abstract class KeyDeserializer
{
  public abstract Object deserializeKey(String paramString, DeserializationContext paramDeserializationContext);

  public static abstract class None extends KeyDeserializer
  {
  }
}

/* Location:           /Users/vikas/Documents/Mhacks_Real_app/classes-dex2jar.jar
 * Qualified Name:     com.fasterxml.jackson.databind.KeyDeserializer
 * JD-Core Version:    0.6.2
 */


text:
/**
 * Helper function which returns random number from range.
 * @param min
 * @param max
 * @returns {number}
 */
function randomNumberFromRange(min,max){
    return Math.floor(Math.random()*(max-min)+min);
}

var mainEnv = new Environment();
mainEnv.settle();
setInterval(function() {
    mainEnv.step();
    mainEnv.draw();
}, 41);

//console.log(mainEnv.microbes);
//console.log(mainEnv.env);