text:
package orgreminders

import (
	"appengine"
	"appengine/datastore"
	"appengine/mail"
	"appengine/user"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"sort"
	"strings"
	"time"
)

// App-global variables
var Templates *template.Template
var Duration_Day = 24 * time.Hour
var Duration_Week = 7 * Duration_Day
var TemplateFiles = []string{
	"tmpl/header.html",
	"tmpl/css.html",
	"tmpl/home.html",
	"tmpl/save.html",
	"tmpl/new-event.html",
	"tmpl/new-org.html",
	"tmpl/editorg.html",
	"tmpl/editevent.html",
	"tmpl/events.html",
	"tmpl/organizations.html",
	"tmpl/error.html",
	"tmpl/cron.html",
	"tmpl/new-member.html",
	"tmpl/members.html",
	"tmpl/editmember.html",
}

type Page struct {
	Error          string
	Events         map[string]Event
	Keys           []*datastore.Key
	Event2Edit     Event
	Organizations  map[string]Organization
	Org2Edit       Organization
	Org2EditKey    string
	Location       time.Location
	AllowNewOrg    bool
	SuperUser      bool
	LoggedIn       bool
	UserEmail      string
	Orgs           []string
	Members        map[string]Member
	SavedEvent     bool
	SavedOrg       bool
	SavedMember    bool
	Member2Edit    Member
	Member2EditKey string
	ScheduleHTML   map[string][]string
}

func NewPage(u *User) (*Page, error) {
	var result = Page{}

	if u.Meta != nil {
		result.LoggedIn = true
		result.AllowNewOrg = true
		result.UserEmail = u.Meta.Email

		if u.SuperUser {
			result.SuperUser = true
		}
	}

	return &result, nil
}

func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
	err := Templates.ExecuteTemplate(w, tmpl+".html", p)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}

func init() {
	templTest, err := template.ParseFiles(TemplateFiles...)
	if err != nil {
		log.Println("Some (or all) of the required templates are missing, exiting: ", err.Error())
		return
	}

	Templates = templTest

	http.HandleFunc("/", DefaultHandler)
	http.HandleFunc("/newevent", NewEventHandler)
	http.HandleFunc("/neworg", NewOrgHandler)
	http.HandleFunc("/events", EventsHandler)
	http.HandleFunc("/organizations", OrgsHandler)
	http.HandleFunc("/saveevent", EventSaveHandler)
	http.HandleFunc("/saveorg", OrgSaveHandler)
	http.HandleFunc("/editorg", OrgEditHandler)
	http.HandleFunc("/editevent", EventEditHandler)
	http.HandleFunc("/cron", CronHandler)
	http.HandleFunc("/logout", LogoutHandler)
	http.HandleFunc("/newmember", NewMemberHandler)
	http.HandleFunc("/savemember", MemberSaveHandler)
	http.HandleFunc("/members", MembersHandler)
	http.HandleFunc("/editmember", MemberEditHandler)
}

func LogoutHandler(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r)
	url, _ := user.LogoutURL(c, "/")
	http.Redirect(w, r, url, http.StatusFound)
}

func DefaultHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)

	title := "home"
	renderTemplate(w, title, p)
}

func NewOrgHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)

	title := "new-org"
	renderTemplate(w, title, p)
}

func NewEventHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)

	title := "new-event"
	for _, org := range u.Orgs {
		p.Orgs = append(p.Orgs, org.Name)
	}

	sort.Strings(p.Orgs)
	renderTemplate(w, title, p)
}

func EventSaveHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)

	r.ParseForm()

	event := NewEvent()
	event.Title = r.PostFormValue("title")
	event.EmailMessage = template.HTML(r.PostFormValue("emailmessage"))
	event.TextMessage = r.PostFormValue("textmessage")
	event.Submitter = *u.Meta
	event.Orgs = r.PostForm["orgs"]

	if len(event.Orgs) < 1 {
		p.Error = "You must choose an organization."
		renderTemplate(w, "error", p)
		return
	}

	if r.PostFormValue("sendemail") == "on" {
		event.Email = true
	}

	if r.PostFormValue("sendtext") == "on" {
		event.Text = true
	}

	// save reminder schedule
	var remqtys = r.PostForm["remqty[]"]
	var remtyps = r.PostForm["remtyp[]"]
	for remkey, remval := range remqtys {
		var entry = fmt.Sprintf("%s%s", remval, remtyps[remkey])
		event.Reminders.Add(entry)
	}

	o, err := GetOrganizationByName(c, event.Orgs[0])

	if err != nil {
		c.Infof("Error: %s", err.Error())
		p.Error = err.Error()
		renderTemplate(w, "error", p)
		return
	}

	location, _ := time.LoadLocation(o.TimeZone)
	const longForm = "01/02/2006 3:04pm"
	t, timeerr := time.ParseInLocation(longForm, r.PostFormValue("due"), location)
	if timeerr != nil {
		http.Error(w, "Invalid time string", http.StatusInternalServerError)
		return
	}

	event.Due = t

	event.Key = r.PostFormValue("key")
	var subject = "Event Saved: "
	if event.Key == "" {
		_, event.Key = event.Save(c)
	} else {
		event.Update(c)
		subject = "Event Updated: "
	}

	if r.PostFormValue("oncreate") == "on" {
		event.Notify(c, true)
	}

	event.DueFormatted = event.Due.In(location).Format("01/02/2006 3:04pm")
	AdminNotify(c, u.Meta.Email, subject+event.Title, "The following event was just saved:

"+event.GetHTMLView(c))

	p.Event2Edit = event
	p.SavedEvent = true

	renderTemplate(w, "save", p)
}

func EventEditHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)
	var ok bool

	ok, p.Event2Edit = GetEventByKey(c, r.FormValue("id"))

	if ok {
		org, _ := GetOrganizationByName(c, p.Event2Edit.Orgs[0])
		location, _ := time.LoadLocation(org.TimeZone)
		p.Event2Edit.DueFormatted = p.Event2Edit.Due.In(location).Format("01/02/2006 3:04pm")

		uorgs := GetOrganizationsByUser(c, u.Meta.Email)
		for _, uorg := range uorgs {
			missing := true
			for _, porg := range p.Event2Edit.Orgs {
				if uorg.Name == porg {
					missing = false
					break
				}
			}

			if missing == true {
				p.Orgs = append(p.Orgs, uorg.Name)
			}
		}

		// Extract usable event reminder list
		p.ScheduleHTML = p.Event2Edit.Reminders.HTML()

		sort.Strings(p.Orgs)
		renderTemplate(w, "editevent", p)
	} else {
		p.Error = "Event not found."
		renderTemplate(w, "error", p)
	}
}

func OrgSaveHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)

	org := NewOrganization()
	org.Name = r.PostFormValue("name")
	org.Description = r.PostFormValue("description")
	org.Active = true
	org.Expires = time.Now().UTC().Add(Duration_Week)
	org.Administrator = strings.Split(r.PostFormValue("admin"), "\r\n")
	org.TimeZone = r.PostFormValue("timezone")

	key := r.PostFormValue("key")
	if key == "" {
		c.Infof("saving org")
		org.Save(c)
	} else {
		c.Infof("updating org")
		org.Update(c, key)
	}

	p.SavedOrg = true
	p.Org2Edit = org
	p.Org2EditKey = key
	renderTemplate(w, "save", p)
}

func OrgEditHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)

	p.Org2EditKey = r.FormValue("id")
	p.Org2Edit = GetOrganizationByKey(c, p.Org2EditKey)

	renderTemplate(w, "editorg", p)
}

func EventsHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	p.Events = make(map[string]Event)
	c := appengine.NewContext(r)

	for _, org := range u.Orgs {
		events := org.GetEvents(c, true)
		location, _ := time.LoadLocation(org.TimeZone)

		for indx, event := range events {
			event.Due = event.Due.In(location)
			event.DueFormatted = event.Due.Format("01/02/2006 3:04pm")
			p.Events[indx] = event
		}
	}

	renderTemplate(w, "events", p)
}

func OrgsHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)
	mapResults := make(map[string]Organization)

	for indx, org := range u.Orgs {
		org.Members = org.GetMembers(c)
		mapResults[indx] = org
	}
	p.Organizations = mapResults

	renderTemplate(w, "organizations", p)
}

func MembersHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	p.Members = make(map[string]Member)
	c := appengine.NewContext(r)

	for _, org := range u.Orgs {
		members := org.GetMembers(c)

		for indx, member := range members {
			p.Members[indx] = member
		}
	}

	renderTemplate(w, "members", p)
}

func NewMemberHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)

	title := "new-member"
	for _, org := range u.Orgs {
		p.Orgs = append(p.Orgs, org.Name)
	}

	sort.Strings(p.Orgs)
	renderTemplate(w, title, p)
}

func MemberEditHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)
	var ok bool

	p.Member2EditKey = r.FormValue("id")
	ok, p.Member2Edit = GetMemberByKey(c, p.Member2EditKey)

	// Protect web users
	if ok && p.Member2Edit.WebUser {
		if u.Meta.Email != p.Member2Edit.Email && u.SuperUser == false {
			ok = false
		}
	}

	if ok {
		uorgs := GetOrganizationsByUser(c, u.Meta.Email)
		for _, uorg := range uorgs {
			missing := true
			for _, porg := range p.Member2Edit.Orgs {
				if uorg.Name == porg {
					missing = false
					break
				}
			}

			if missing == true {
				p.Orgs = append(p.Orgs, uorg.Name)
			}
		}

		sort.Strings(p.Orgs)
		renderTemplate(w, "editmember", p)
	} else {
		p.Error = "Member not found or access denied."
		renderTemplate(w, "error", p)
	}
}

func MemberSaveHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	c := appengine.NewContext(r)

	r.ParseForm()

	member := Member{}
	member.Name = r.PostFormValue("name")
	member.Email = r.PostFormValue("email")
	member.Cell = r.PostFormValue("cell")
	member.Carrier = r.PostFormValue("carrier")
	member.TextAddr = GenTextAddr(member.Cell, member.Carrier)
	member.Orgs = r.PostForm["orgs"]

	if r.PostFormValue("emailon") == "on" {
		member.EmailOn = true
	}

	if r.PostFormValue("texton") == "on" {
		member.TextOn = true
	}

	if u.SuperUser && r.PostFormValue("webuser") == "on" {
		member.WebUser = true
	}

	// Must have or don't save
	if len(r.PostForm["orgs"]) <= 0 && member.WebUser == false {
		p.Error = "Cannot save without an organization."
		renderTemplate(w, "error", p)
		return
	}

	key := r.PostFormValue("key")
	if key == "" {
		c.Infof("saving member")
		_, key = member.Save(c)
	} else {
		c.Infof("updating member")
		member.Update(c, key)
	}

	p.Member2Edit = member
	p.Member2EditKey = key
	p.SavedMember = true
	renderTemplate(w, "save", p)
}

func AdminNotify(c appengine.Context, creator string, subject string, message string) {
	var appid = appengine.AppID(c)
	msg := &mail.Message{
		Sender:   "orgreminders@" + appid + ".appspotmail.com",
		Subject:  subject,
		HTMLBody: message,
		To:       []string{creator},
	}

	c.Infof("notify (%s): %v", subject, creator)

	if err := mail.Send(c, msg); err != nil {
		c.Errorf("Couldn't send email: %v", err)
	}
}

func SendOrgMessage(c appengine.Context, o Organization, e Event, t string) (result bool) {
	var appid = appengine.AppID(c)
	var senderUserName = strings.Replace(o.Name, " ", "_", -1)
	var sender = fmt.Sprintf("%s Reminders <%s@%s.appspotmail.com", o.Name, senderUserName, appid)
	members := o.GetMembers(c)
	recipients := []string{}

	for _, m := range members {
		if t == "email" && m.EmailOn {
			recipients = append(recipients, m.Email)
		} else if t == "text" && m.TextOn {
			recipients = append(recipients, m.TextAddr)
		}
	}

	if len(recipients) == 0 {
		c.Infof("No recipients, not sending reminder (" + t + ")")
		result = true
		return
	}

	// get rid of duplicate recipients
	recipients = removeDuplicates(recipients)

	msg := &mail.Message{
		Sender:   sender,
		Bcc:      recipients,
		Subject:  e.Title,
		Body:     e.TextMessage,
		HTMLBody: string(e.EmailMessage),
	}

	c.Infof("notify (%s): %v", e.Title, recipients)
	if err := mail.Send(c, msg); err != nil {
		c.Errorf("Couldn't send email: %v", err)
	} else {
		result = true
	}

	return
}

func CronHandler(w http.ResponseWriter, r *http.Request) {
	u := UserLookup(w, r)
	p, _ := NewPage(&u)
	p.Events = make(map[string]Event)
	c := appengine.NewContext(r)

	events := GetAllEvents(c, true) // active only
	//c.Infof("# events to check for cron: %v", len(events))
	for key, event := range events {
		//c.Infof("checking event: %s", event.Title)
		res := event.Notify(c, false)
		if res {
			org, _ := GetOrganizationByName(c, event.Orgs[0])
			location, _ := time.LoadLocation(org.TimeZone)
			event.Due = event.Due.In(location)
			event.DueFormatted = event.Due.Format("01/02/2006 3:04pm")
			p.Events[key] = event
		}
	}

	renderTemplate(w, "cron", p)
}

// from: https://groups.google.com/d/msg/golang-nuts/-pqkICuokio/KqJ0091EzVcJ
func removeDuplicates(a []string) []string {
	result := []string{}
	seen := map[string]string{}
	for _, val := range a {
		if _, ok := seen[val]; !ok {
			result = append(result, val)
			seen[val] = val
		}
	}
	return result
}


text:
#pragma once

#include <folly/ExceptionWrapper.h>
#include <folly/experimental/exception_tracer/ExceptionTracer.h>

#if FOLLY_HAVE_ELF && FOLLY_HAVE_DWARF

#if defined(__GLIBCXX__)

// These functions report stack traces if available.
// To enable collecting stack traces your binary must also include the
// smart_exception_stack_trace_hooks target.

namespace folly {
namespace exception_tracer {

ExceptionInfo getTrace(const std::exception_ptr& ex);

ExceptionInfo getTrace(const std::exception& ex);

ExceptionInfo getTrace(const exception_wrapper& ew);

ExceptionInfo getAsyncTrace(const std::exception_ptr& ex);

ExceptionInfo getAsyncTrace(const std::exception& ex);

ExceptionInfo getAsyncTrace(const exception_wrapper& ew);

} // namespace exception_tracer
} // namespace folly

#endif // defined(__GLIBCXX__)

#endif // FOLLY_HAVE_ELF && FOLLY_HAVE_DWARF

redpajama_set_name: RedPajamaGithub


text:
var mongoose = require('mongoose');

var Schema = mongoose.Schema;

var taskStatuses = ['Closed', 'Open', 'Reopened', 'In Progress', 'Completed'];

var taskSchema = new Schema({
    name:String,
    owner: Schema.Types.ObjectId,
    startDate: Date,
    endDate: Date,
    status: String,
    project: Schema.Types.ObjectId,
    description: String
});

exports.taskSchema = taskSchema;
exports.taskStatuses = taskStatuses;


text:
<?php

require_once('controllers/node/content/default.php');

class Onxshop_Controller_Node_Content_Textile extends Onxshop_Controller_Node_Content_Default {

	/**
	 * main action
	 */

	public function mainAction() {

		require_once('models/common/common_node.php');

		$Node = new common_node();

		$node_data = $Node->nodeDetail($this->GET['id']);

		if ($node_data['content']) {
			$node_data['content'] = $this->parseTextile($node_data['content']);
		}

		$this->tpl->assign("NODE", $node_data);

		if ($node_data['display_title'])  $this->tpl->parse('content.title');

		return true;
	}

	/**
	 * parse textile
	 */

	public function parseTextile($text) {

		// function defined in onxshop.functions.php
		return textile($text);
	}
}


text:
<?php

namespace Symfasize\Bundle\ConfigurationBundle\Dto;

use Symfony\Component\Validator\Constraints as Assert;

class Bundle
{
    /**
     * @Assert\NotBlank(message="bundle.namespace.not_blank")
     * @Assert\Regex(pattern="/^\w+\/([\w\/]*)\w+Bundle$/", message="bundle.regex.namespace")
     *
     * @var string
     */
    private $namespace;

    /**
     * @Assert\NotBlank(message="bundle.name.not_blank")
     * @Assert\Regex(pattern="/^\w+Bundle$/", message="bundle.regex.name")
     *
     * @var string
     */
    private $name;

    /**
     * @return string
     */
    public function getId()
    {
        // otherwise form workflow will break with "/"
        return str_replace('/', '_', $this->namespace . ':' . $this->name);
    }

    /**
     * @param string $namespace
     */
    public function setNamespace($namespace)
    {
        $this->namespace = $namespace;
    }

    /**
     *
     * @return string
     */
    public function getNamespace()
    {
        return $this->namespace;
    }

    /**
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
}


text:
package se.jesjens.jesdob.query.condition;

import se.jesjens.jesdob.IDob;

/**
 * A Condition for checking if a IDob doesn't contains a specific attribute,
 * or if this attribute does not contains a specific value or not.
 *
 * @author jenss
 */
public class AttrContainsNotCondition implements ICondition {

  private final String attribute;
  private final String value;

  /**
   * Constructor.
   *
   * @param attribute The attribute we want to check.
   * @param value The value we want to check if the attribute does not contain.
   */
  public AttrContainsNotCondition(String attribute, String value) {
    this.attribute = attribute;
    this.value = value;
  }

  /**
   * This will check if the dob has a specific attribute, and if this attribute
   * doesn't contains a specific char sequence.
   *
   * If the dob has not the attribute, the condition will return true.
   * If the dob has the attribute, but the value of the attribute is not the supplied value, the condition will return true.
   * If the dob has the attribute, and the value equals the supplied value, the condition will return false.
   * If the dob has the attribute, and the value contains the supplied value, the condition will return false.
   *
   * Example:
   * value = "def"
   * "abcdefghijklm" - false, contains "def".
   * "def" - false, contains "def".
   * "abcde" - true, does not contain "def".
   *
   * @param dob The IDob to test.
   * @return True or false, depending on if the condition is true for the
   * IDob-object or not.
   */
  @Override
  public boolean isTrue(IDob dob) {
    return !(dob.hasAttr(attribute)
            && dob.attr(attribute).contains(value));
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.developerstudio</groupId>
        <artifactId>wso2-eclipse-carbonstudio-gadget-feature</artifactId>
        <version>3.8.0-SNAPSHOT</version>
    </parent>
    <groupId>com.googlecode.wso2</groupId>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>com.googlecode.osde.feature</artifactId>
    <packaging>pom</packaging>
    <name>Gadget Editor, Deployment and Testing Tools</name>
    <url>http://wso2.org</url>
    <description>This feature contains Open Social Development Environment Plugin which enables a gadget editor, deployment and testing tools</description>
    <build>
        <plugins>
            <plugin>
                <groupId>org.wso2.maven</groupId>
                <artifactId>carbon-p2-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>p2-feature-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-feature-gen</goal>
                        </goals>
                        <configuration>
                            <id>${project.artifactId}</id>
                            <propertiesFile>../../feature.properties</propertiesFile>
                            <bundles>
                                <bundleDef>com.googlecode.wso2:com.googlecode.osde:${osde.tools.version}</bundleDef>
                            </bundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
import { Injectable }      from '@angular/core';

@Injectable()
export class SphereValidation {

  listValidations: any = [ ];

  confirmContext(context: any, confirm: any) {
    if(! context.confirmed) {
          return <any>Object.assign(
                context, confirm);}
    return context;
  }

  validation(cmd: string, context: any) {
    switch(cmd) {
      default:
        context['confirmed'] = true;
        return context;
    }
  }
}


text:
// ----------------------------------------------------------------------
// This code is developed as part of the Java CoG Kit project
// The terms of the license can be found at http://www.cogkit.org/license
// This message may not be removed or altered.
// ----------------------------------------------------------------------

package org.globus.cog.util.timer;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Timestamp
{
	/**
	   Year Month Day hour minutes seconds
	 */
	static DateFormat YMDhms =
		new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");

	/**
	   Current time as: Year/Month/Day hour:minutes:seconds
	 */
	public static String YMDhms()
	{
		Date now = new Date();
		String result = YMDhms.format(now);
		return result;
	}

	/**
	   Year Month Day hour minutes seconds
	 */
	static DateFormat YMDhms_dash =
		new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");

	/**
	   Current time as: Year_Month_Day_hour_minutes_seconds
	   Good for file names
	 */
	public static String YMDhms_dash()
	{
		Date now = new Date();
		String result = YMDhms_dash.format(now);
		return result;
	}
}


text:
package org.jai.search.actors;

import org.jai.search.data.SampleDataGeneratorService;
import org.jai.search.setup.SetupIndexService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;

import scala.concurrent.Await;
import scala.concurrent.Future;
import scala.concurrent.duration.Duration;
import akka.actor.ActorRef;
import akka.pattern.Patterns;
import akka.util.Timeout;

@Service
public class BootStrapIndexingServiceImpl implements BootStrapIndexService {
	private static final Logger logger = LoggerFactory
			.getLogger(BootStrapIndexingServiceImpl.class);

	@Autowired
	private SampleDataGeneratorService sampleDataGenerator;

	@Autowired
	private SetupIndexService setupIndexService;

	@Autowired
	private ActorRef setupIndexMasterActor;

	@Override
	public void preparingIndexes() {
		logger.info("Starting index preparation for {}",
				IndexingMessage.REBUILD_ALL_INDICES);
		setupIndexMasterActor.tell(IndexingMessage.REBUILD_ALL_INDICES, null);
		final Timeout timeout = new Timeout(Duration.create(10, "seconds"));
		final StopWatch stopWatch = new StopWatch();
		Future<Object> future = Patterns.ask(setupIndexMasterActor,
				IndexingMessage.REBUILD_ALL_INDICES_DONE, timeout);
		try {
			// Allow only to run for max 5 min. and check every few sec usign
			// thread sleep.
			stopWatch.start();
			while (!(Boolean) Await.result(future, timeout.duration())
					&& stopWatch.getTotalTimeSeconds() < 5 * 60) {
				future = Patterns.ask(setupIndexMasterActor,
						IndexingMessage.REBUILD_ALL_INDICES_DONE, timeout);
				logger.debug("Index setup status check, Got back " + false);
				// TODO: use this, based on your time taken by ur env. here, 100
				// ms
				Thread.sleep(100);
			}
			logger.debug("Index setup status check, Got back " + true);
		} catch (final Exception e) {
			logger.debug("Index setup status check, Failed getting result: "
					+ e.getMessage());
			throw new RuntimeException(
					"Error occured while setting up search index!", e);
		}
		logger.debug("All indexing setup finished using Akka system, Enjoy!");
	}
}


text:
Copyright 2016 Gregory Bryant

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 "ProjectHeaders.h"

// Macros for interface casts
//#ifdef __cplusplus
//#define IID_PPV_ARG(IType, ppType) IID_##IType, reinterpret_cast(static_cast(ppType))
//#else
#define IID_PPV_ARG(IType, ppType) &IID_##IType, (void**)(ppType)
//#endif

// Retrieves the UIObject interface for the specified full PIDL
STDAPI SHGetUIObjectFromFullPIDL(LPCITEMIDLIST pidl, HWND hwnd, REFIID riid, void **ppv)
{
    LPCITEMIDLIST pidlChild;
    IShellFolder* psf;

    *ppv = NULL;

    HRESULT hr = SHBindToParent(pidl, IID_IShellFolder, (void**)(&psf) , &pidlChild);
    if (SUCCEEDED(hr))
    {
        hr = psf->GetUIObjectOf(hwnd, 1, &pidlChild, riid, NULL, ppv);
        psf->Release();
    }
    return hr;
}

#define ILSkip(pidl, cb)       ((LPITEMIDLIST)(((BYTE*)(pidl))+cb))
#define ILNext(pidl)           ILSkip(pidl, (pidl)->mkid.cb)

HRESULT SHILClone(LPCITEMIDLIST pidl, LPITEMIDLIST *ppidl)
{
    DWORD cbTotal = 0;

    if (pidl)
    {
        cbTotal += sizeof(pidl->mkid.cb);
        while (pidl->mkid.cb)
        {
            cbTotal += pidl->mkid.cb;
            pidl = ILNext(pidl);
        }
    }

    *ppidl = (LPITEMIDLIST)CoTaskMemAlloc(cbTotal);

    if (*ppidl)
        CopyMemory(*ppidl, pidl, cbTotal);

    return  *ppidl ? S_OK: E_OUTOFMEMORY;
}

// Get the target PIDL for a folder PIDL. This deals with cases where a folder
// is an alias to a real folder, folder shortcuts, etc.
STDAPI SHGetTargetFolderIDList(LPCITEMIDLIST pidlFolder, LPITEMIDLIST *ppidl)
{
    IShellLink *psl;

    *ppidl = NULL;

    HRESULT hr = SHGetUIObjectFromFullPIDL(pidlFolder, 0 , IID_IShellLinkA, (void**)(&psl) );

    if (SUCCEEDED(hr))
    {
        hr = psl->GetIDList(ppidl);
        psl->Release();
    }

    // It's not a folder shortcut so get the PIDL normally.
    if (FAILED(hr))
        hr = SHILClone(pidlFolder, ppidl);

    return hr;
}

// Get the target folder for a folder PIDL. This deals with cases where a folder
// is an alias to a real folder, folder shortcuts, the My Documents folder, etc.
STDAPI SHGetTargetFolderPath(LPCITEMIDLIST pidlFolder, LPWSTR pszPath, UINT cchPath)
{
    LPITEMIDLIST pidlTarget;

    *pszPath = 0;

    HRESULT hr = SHGetTargetFolderIDList(pidlFolder, &pidlTarget);

    if (SUCCEEDED(hr))
    {
        SHGetPathFromIDListW(pidlTarget, pszPath);   // Make sure it is a path
        CoTaskMemFree(pidlTarget);
    }

    return *pszPath ? S_OK : E_FAIL;
}


text:
describe RuboCop::Cop::Lint::UriEscapeUnescape do
  let(:config) { RuboCop::Config.new }
  subject(:cop) { described_class.new(config) }

  it "registers an offense when using `URI.escape('http://example.com')`" do
    expect_offense(<<-RUBY.strip_indent)
      URI.escape('http://example.com')
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `URI.escape` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending on your specific use case.
    RUBY
  end

  it "registers an offense when using `URI.escape('@?@!', '!?')`" do
    expect_offense(<<-RUBY.strip_indent)
      URI.escape('@?@!', '!?')
      ^^^^^^^^^^^^^^^^^^^^^^^^ `URI.escape` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending on your specific use case.
    RUBY
  end

  it "registers an offense when using `::URI.escape('http://example.com')`" do
    expect_offense(<<-RUBY.strip_indent)
      ::URI.escape('http://example.com')
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `::URI.escape` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending on your specific use case.
    RUBY
  end

  it "registers an offense when using `URI.encode('http://example.com')`" do
    expect_offense(<<-RUBY.strip_indent)
      URI.encode('http://example.com')
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `URI.encode` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending on your specific use case.
    RUBY
  end

  it "registers an offense when using `::URI.encode('http://example.com)`" do
    expect_offense(<<-RUBY.strip_indent)
      ::URI.encode('http://example.com')
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `::URI.encode` method is obsolete and should not be used. Instead, use `CGI.escape`, `URI.encode_www_form` or `URI.encode_www_form_component` depending on your specific use case.
    RUBY
  end

  it 'registers an offense when using `URI.unescape(enc_uri)`' do
    expect_offense(<<-RUBY.strip_indent)
      URI.unescape(enc_uri)
      ^^^^^^^^^^^^^^^^^^^^^ `URI.unescape` method is obsolete and should not be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component` depending on your specific use case.
    RUBY
  end

  it 'registers an offense when using `::URI.unescape(enc_uri)`' do
    expect_offense(<<-RUBY.strip_indent)
      ::URI.unescape(enc_uri)
      ^^^^^^^^^^^^^^^^^^^^^^^ `::URI.unescape` method is obsolete and should not be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component` depending on your specific use case.
    RUBY
  end

  it 'registers an offense when using `URI.decode(enc_uri)`' do
    expect_offense(<<-RUBY.strip_indent)
      URI.decode(enc_uri)
      ^^^^^^^^^^^^^^^^^^^ `URI.decode` method is obsolete and should not be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component` depending on your specific use case.
    RUBY
  end

  it 'registers an offense when using `::URI.decode(enc_uri)`' do
    expect_offense(<<-RUBY.strip_indent)
      ::URI.decode(enc_uri)
      ^^^^^^^^^^^^^^^^^^^^^ `::URI.decode` method is obsolete and should not be used. Instead, use `CGI.unescape`, `URI.decode_www_form` or `URI.decode_www_form_component` depending on your specific use case.
    RUBY
  end
end


text:
declare type EasingFunction = (amount: number) => number;
/**
 * The Ease class provides a collection of easing functions for use with tween.js.
 */
declare const Easing: {
    Linear: {
        None: (amount: number) => number;
    };
    Quadratic: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Cubic: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Quartic: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Quintic: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Sinusoidal: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Exponential: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Circular: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Elastic: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Back: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
    Bounce: {
        In: (amount: number) => number;
        Out: (amount: number) => number;
        InOut: (amount: number) => number;
    };
};

/**
 *
 */
declare type InterpolationFunction = (v: number[], k: number) => number;
/**
 *
 */
declare const Interpolation: {
    Linear: (v: number[], k: number) => number;
    Bezier: (v: number[], k: number) => number;
    CatmullRom: (v: number[], k: number) => number;
    Utils: {
        Linear: (p0: number, p1: number, t: number) => number;
        Bernstein: (n: number, i: number) => number;
        Factorial: (n: number) => number;
        CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
    };
};

declare class Tween<T extends UnknownProps> {
    private _object;
    private _group;
    private _isPaused;
    private _pauseStart;
    private _valuesStart;
    private _valuesEnd;
    private _valuesStartRepeat;
    private _duration;
    private _initialRepeat;
    private _repeat;
    private _repeatDelayTime?;
    private _yoyo;
    private _isPlaying;
    private _reversed;
    private _delayTime;
    private _startTime;
    private _easingFunction;
    private _interpolationFunction;
    private _chainedTweens;
    private _onStartCallback?;
    private _onStartCallbackFired;
    private _onUpdateCallback?;
    private _onRepeatCallback?;
    private _onCompleteCallback?;
    private _onStopCallback?;
    private _id;
    private _isChainStopped;
    constructor(_object: T, _group?: Group);
    getId(): number;
    isPlaying(): boolean;
    isPaused(): boolean;
    to(properties: UnknownProps, duration?: number): this;
    duration(d: number): this;
    start(time?: number): this;
    private _setupProperties;
    stop(): this;
    end(): this;
    pause(time: number): this;
    resume(time: number): this;
    stopChainedTweens(): this;
    group(group: Group): this;
    delay(amount: number): this;
    repeat(times: number): this;
    repeatDelay(amount: number): this;
    yoyo(yoyo: boolean): this;
    easing(easingFunction: EasingFunction): this;
    interpolation(interpolationFunction: InterpolationFunction): this;
    chain(...tweens: Array<Tween<UnknownProps>>): this;
    onStart(callback: (object: T) => void): this;
    onUpdate(callback: (object: T, elapsed: number) => void): this;
    onRepeat(callback: (object: T) => void): this;
    onComplete(callback: (object: T) => void): this;
    onStop(callback: (object: T) => void): this;
    update(time?: number): boolean;
    private _updateProperties;
    private _handleRelativeValue;
    private _swapEndStartRepeatValues;
}
declare type UnknownProps = Record<string, unknown>;

/**
 * Controlling groups of tweens
 *
 * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
 * In these cases, you may want to create your own smaller groups of tween
 */
declare class Group {
    private _tweens;
    private _tweensAddedDuringUpdate;
    getAll(): Array<Tween<UnknownProps>>;
    removeAll(): void;
    add(tween: Tween<UnknownProps>): void;
    remove(tween: Tween<UnknownProps>): void;
    update(time: number, preserve?: boolean): boolean;
}

declare let now: () => number;

/**
 * Utils
 */
declare class Sequence {
    private static _nextId;
    static nextId(): number;
}

declare const VERSION = "18.6.1";

declare const nextId: typeof Sequence.nextId;
declare const getAll: () => Tween<Record<string, unknown>>[];
declare const removeAll: () => void;
declare const add: (tween: Tween<Record<string, unknown>>) => void;
declare const remove: (tween: Tween<Record<string, unknown>>) => void;
declare const update: (time: number, preserve?: boolean | undefined) => boolean;
declare const exports: {
    Easing: {
        Linear: {
            None: (amount: number) => number;
        };
        Quadratic: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Cubic: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Quartic: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Quintic: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Sinusoidal: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Exponential: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Circular: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Elastic: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Back: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
        Bounce: {
            In: (amount: number) => number;
            Out: (amount: number) => number;
            InOut: (amount: number) => number;
        };
    };
    Group: typeof Group;
    Interpolation: {
        Linear: (v: number[], k: number) => number;
        Bezier: (v: number[], k: number) => number;
        CatmullRom: (v: number[], k: number) => number;
        Utils: {
            Linear: (p0: number, p1: number, t: number) => number;
            Bernstein: (n: number, i: number) => number;
            Factorial: (n: number) => number;
            CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
        };
    };
    now: () => number;
    Sequence: typeof Sequence;
    nextId: typeof Sequence.nextId;
    Tween: typeof Tween;
    VERSION: string;
    getAll: () => Tween<Record<string, unknown>>[];
    removeAll: () => void;
    add: (tween: Tween<Record<string, unknown>>) => void;
    remove: (tween: Tween<Record<string, unknown>>) => void;
    update: (time: number, preserve?: boolean | undefined) => boolean;
};

export default exports;
export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, getAll, nextId, now, remove, removeAll, update };


text:
package org.orgama.client;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Timer;
import java.util.HashMap;

/**
 * Event hub for the entire application
 * @author kguthrie
 */
public class EventBus {

	private static final HashMap<String, Timer> timersByChannel =
			new HashMap<String, Timer>();

	/**
	 * Class for providing the static instance of the contained event bus
	 */
	public static class Provider implements
			com.google.inject.Provider<com.google.gwt.event.shared.EventBus> {

		@Override
		public com.google.gwt.event.shared.EventBus get() {
			return EventBus.get();
		}

	}

    private static final com.google.gwt.event.shared.EventBus eventBus =
			new com.google.gwt.event.shared.SimpleEventBus();

    /**
     * fire the given event
     * @param type
     * @param event
     */
    public static void fireEvent(GwtEvent<?> event) {
        eventBus.fireEvent(event);
    }

	/**
	 * fire the given event asynchronously after the given delay in milliseconds
	 * has passed
	 * @param event
	 * @param millisecondsDelay
	 */
	public static void fireEventWithDelay(final GwtEvent<?> event,
			int millisecondsDelay) {
		Timer t = new Timer() {

			@Override
			public void run() {
				fireEvent(event);
			}
		};
		t.schedule(millisecondsDelay);
	}

	/**
	 * fire the given event asynchronously after the given delay in milliseconds
	 * has passed unless another event is fired with same override channel
	 * before the delay given here expires; in this case, the event fired here
	 * is overridden and not fired at all.
	 * @param event
	 * @param millisecondsDelay
	 */
	public static void fireEventWithOverride(final GwtEvent<?> event,
			String overrideChannel, int millisecondsDelay) {

		Timer t = new Timer() {

			@Override
			public void run() {
				fireEvent(event);
			}
		};

		t.schedule(millisecondsDelay);

		Timer oldTimer = timersByChannel.put(overrideChannel, t);

		if (oldTimer != null) {
			oldTimer.cancel();
		}
	}

    /**
     * fire the given event from the given source
     * @param event
     * @param source
     */
    public static void fireEvent(GwtEvent<?> event, Object source) {
        eventBus.fireEventFromSource(event, source);
    }

	/**
	 * fire the given event asynchronously from the given source after the
	 * given delay in milliseconds has passed
	 * @param event
	 * @param millisecondsDelay
	 */
	public static void fireEventWithDelay(final GwtEvent<?> event,
			final Object source, int millisecondsDelay) {
		Timer t = new Timer() {

			@Override
			public void run() {
				fireEvent(event, source);
			}
		};
		t.schedule(millisecondsDelay);
	}

	/**
	 * fire the given event asynchronously after the given delay in milliseconds
	 * has passed unless another event is fired with same override channel
	 * before the delay given here expires; in this case, the event fired here
	 * is overridden and not fired at all.
	 * @param event
	 * @param millisecondsDelay
	 */
	public static void fireEventWithOverride(final GwtEvent<?> event,
			final Object source, String overrideChannel,
			int millisecondsDelay) {

		Timer t = new Timer() {

			@Override
			public void run() {
				fireEvent(event, source);
			}
		};

		t.schedule(millisecondsDelay);

		Timer oldTimer = timersByChannel.put(overrideChannel, t);

		if (oldTimer != null) {
			oldTimer.cancel();
		}
	}

    /**
     * add a handler for the given event type
     * @param <T>
     * @param type
     * @param handler
     */
    public static <T extends EventHandler> HandlerRegistration addHandler(
            GwtEvent.Type<T> type, T handler) {
        return eventBus.addHandler(type, handler);
    }

    /**
     * add an event handler
     * @param <T>
     * @param type
     * @param handler
     * @param sender
     */
    public static <T extends EventHandler> HandlerRegistration addHandler(
            GwtEvent.Type<T> type, T handler, Object source) {
        return eventBus.addHandlerToSource(type, source, handler);
    }

    /**
     * gets the singleton instance of the event bus for classes that need
     * actual instances of it
     * @return
     */
    public static com.google.gwt.event.shared.EventBus get() {
        return eventBus;
    }
}


text:
package org.locationtech.geowave.core.store.memory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.UUID;
import java.util.stream.Collectors;
import org.apache.commons.lang3.ArrayUtils;
import org.locationtech.geowave.core.index.ByteArray;
import org.locationtech.geowave.core.index.ByteArrayRange;
import org.locationtech.geowave.core.index.ByteArrayUtils;
import org.locationtech.geowave.core.index.SinglePartitionQueryRanges;
import org.locationtech.geowave.core.index.StringUtils;
import org.locationtech.geowave.core.store.BaseDataStoreOptions;
import org.locationtech.geowave.core.store.CloseableIterator;
import org.locationtech.geowave.core.store.DataStoreOptions;
import org.locationtech.geowave.core.store.adapter.InternalAdapterStore;
import org.locationtech.geowave.core.store.adapter.InternalDataAdapter;
import org.locationtech.geowave.core.store.adapter.PersistentAdapterStore;
import org.locationtech.geowave.core.store.api.Index;
import org.locationtech.geowave.core.store.data.DeferredReadCommonIndexedPersistenceEncoding;
import org.locationtech.geowave.core.store.data.MultiFieldPersistentDataset;
import org.locationtech.geowave.core.store.data.PersistentDataset;
import org.locationtech.geowave.core.store.data.UnreadFieldDataList;
import org.locationtech.geowave.core.store.entities.GeoWaveKeyImpl;
import org.locationtech.geowave.core.store.entities.GeoWaveMetadata;
import org.locationtech.geowave.core.store.entities.GeoWaveRow;
import org.locationtech.geowave.core.store.entities.GeoWaveRowImpl;
import org.locationtech.geowave.core.store.entities.GeoWaveRowIteratorTransformer;
import org.locationtech.geowave.core.store.entities.GeoWaveValue;
import org.locationtech.geowave.core.store.flatten.FlattenedUnreadData;
import org.locationtech.geowave.core.store.metadata.AbstractGeoWavePersistence;
import org.locationtech.geowave.core.store.metadata.MetadataIterators;
import org.locationtech.geowave.core.store.operations.DataStoreOperations;
import org.locationtech.geowave.core.store.operations.MetadataDeleter;
import org.locationtech.geowave.core.store.operations.MetadataQuery;
import org.locationtech.geowave.core.store.operations.MetadataReader;
import org.locationtech.geowave.core.store.operations.MetadataType;
import org.locationtech.geowave.core.store.operations.MetadataWriter;
import org.locationtech.geowave.core.store.operations.ReaderParams;
import org.locationtech.geowave.core.store.operations.RowDeleter;
import org.locationtech.geowave.core.store.operations.RowReader;
import org.locationtech.geowave.core.store.operations.RowWriter;
import org.locationtech.geowave.core.store.util.DataStoreUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Predicate;
import com.google.common.collect.Iterators;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
import com.google.common.primitives.UnsignedBytes;

public class MemoryDataStoreOperations implements DataStoreOperations {
  private static final Logger LOGGER = LoggerFactory.getLogger(MemoryDataStoreOperations.class);
  private final Map<String, SortedSet<MemoryStoreEntry>> storeData =
      Collections.synchronizedMap(new HashMap<String, SortedSet<MemoryStoreEntry>>());
  private final Map<MetadataType, SortedSet<MemoryMetadataEntry>> metadataStore =
      Collections.synchronizedMap(new HashMap<MetadataType, SortedSet<MemoryMetadataEntry>>());
  private final DataStoreOptions options;

  public MemoryDataStoreOperations() {
    this(new BaseDataStoreOptions() {
      @Override
      public boolean isServerSideLibraryEnabled() {
        // memory datastore doesn't have a serverside option
        return false;
      }
    });
  }

  public MemoryDataStoreOperations(final DataStoreOptions options) {
    this.options = options;
  }

  @Override
  public boolean indexExists(final String indexName) throws IOException {
    if (AbstractGeoWavePersistence.METADATA_TABLE.equals(indexName)) {
      return !metadataStore.isEmpty();
    }
    return storeData.containsKey(indexName);
  }

  @Override
  public void deleteAll() throws Exception {
    storeData.clear();
    metadataStore.clear();
  }

  @Override
  public boolean deleteAll(
      final String tableName,
      final String typeName,
      final Short internalAdapterId,
      final String... additionalAuthorizations) {
    return false;
  }

  @Override
  public RowWriter createWriter(final Index index, final InternalDataAdapter<?> adapter) {
    return new MyIndexWriter<>(index.getName());
  }

  @Override
  public RowDeleter createRowDeleter(
      final String indexName,
      final PersistentAdapterStore adapterStore,
      final InternalAdapterStore internalAdapterStore,
      final String... authorizations) {
    return new MyIndexDeleter(indexName, authorizations);
  }

  protected SortedSet<MemoryStoreEntry> getRowsForIndex(final String id) {
    SortedSet<MemoryStoreEntry> set = storeData.get(id);
    if (set == null) {
      set = Collections.synchronizedSortedSet(new TreeSet<MemoryStoreEntry>());
      storeData.put(id, set);
    }
    return set;
  }

  @Override
  public <T> RowReader<T> createReader(final ReaderParams<T> readerParams) {
    final SortedSet<MemoryStoreEntry> internalData =
        storeData.get(readerParams.getIndex().getName());
    int counter = 0;
    List<MemoryStoreEntry> retVal = new ArrayList<>();
    final Collection<SinglePartitionQueryRanges> partitionRanges =
        readerParams.getQueryRanges().getPartitionQueryRanges();
    if ((partitionRanges == null) || partitionRanges.isEmpty()) {
      retVal.addAll(internalData);
      // remove unauthorized
      final Iterator<MemoryStoreEntry> it = retVal.iterator();
      while (it.hasNext()) {
        if (!isAuthorized(it.next(), readerParams.getAdditionalAuthorizations())) {
          it.remove();
        }
      }
      if ((readerParams.getLimit() != null)
          && (readerParams.getLimit() > 0)
          && (retVal.size() > readerParams.getLimit())) {
        retVal = retVal.subList(0, readerParams.getLimit());
      }
    } else {
      for (final SinglePartitionQueryRanges p : partitionRanges) {
        for (final ByteArrayRange r : p.getSortKeyRanges()) {
          final SortedSet<MemoryStoreEntry> set;
          if (r.isSingleValue()) {
            set =
                Sets.newTreeSet(
                    internalData.subSet(
                        new MemoryStoreEntry(p.getPartitionKey(), r.getStart()),
                        new MemoryStoreEntry(
                            p.getPartitionKey(),
                            ByteArrayUtils.getNextPrefix(r.getStart()))));
          } else {
            set =
                Sets.newTreeSet(
                    internalData.tailSet(
                        new MemoryStoreEntry(p.getPartitionKey(), r.getStart())).headSet(
                            new MemoryStoreEntry(p.getPartitionKey(), r.getEndAsNextPrefix())));
          }
          // remove unauthorized
          final Iterator<MemoryStoreEntry> it = set.iterator();
          while (it.hasNext()) {
            final MemoryStoreEntry entry = it.next();
            if (!isAuthorized(entry, readerParams.getAdditionalAuthorizations())) {
              it.remove();
            } else if (!ArrayUtils.contains(
                readerParams.getAdapterIds(),
                entry.row.getAdapterId())) {
              it.remove();
            }
          }
          if ((readerParams.getLimit() != null)
              && (readerParams.getLimit() > 0)
              && ((counter + set.size()) > readerParams.getLimit())) {
            final List<MemoryStoreEntry> subset = new ArrayList<>(set);
            retVal.addAll(subset.subList(0, readerParams.getLimit() - counter));
            break;
          } else {
            retVal.addAll(set);
            counter += set.size();
            if ((readerParams.getLimit() != null)
                && (readerParams.getLimit() > 0)
                && (counter >= readerParams.getLimit())) {
              break;
            }
          }
        }
      }
    }
    return new MyIndexReader<>(
        Iterators.filter(retVal.iterator(), new Predicate<MemoryStoreEntry>() {
          @Override
          public boolean apply(final MemoryStoreEntry input) {
            if ((readerParams.getFilter() != null) && options.isServerSideLibraryEnabled()) {
              final PersistentDataset<Object> commonData = new MultiFieldPersistentDataset<>();
              final List<FlattenedUnreadData> unreadData = new ArrayList<>();
              final List<String> commonIndexFieldNames =
                  DataStoreUtils.getUniqueDimensionFields(readerParams.getIndex().getIndexModel());
              for (final GeoWaveValue v : input.getRow().getFieldValues()) {
                unreadData.add(
                    DataStoreUtils.aggregateFieldData(
                        input.getRow(),
                        v,
                        commonData,
                        readerParams.getIndex().getIndexModel(),
                        commonIndexFieldNames));
              }
              return readerParams.getFilter().accept(
                  readerParams.getIndex().getIndexModel(),
                  new DeferredReadCommonIndexedPersistenceEncoding(
                      input.getRow().getAdapterId(),
                      input.getRow().getDataId(),
                      input.getRow().getPartitionKey(),
                      input.getRow().getSortKey(),
                      input.getRow().getNumberOfDuplicates(),
                      commonData,
                      unreadData.isEmpty() ? null : new UnreadFieldDataList(unreadData)));
            }
            return true;
          }
        }),
        readerParams.getRowTransformer());
  }

  private boolean isAuthorized(final MemoryStoreEntry row, final String... authorizations) {
    for (final GeoWaveValue value : row.getRow().getFieldValues()) {
      if (!MemoryStoreUtils.isAuthorized(value.getVisibility(), authorizations)) {
        return false;
      }
    }
    return true;
  }

  private static class MyIndexReader<T> implements RowReader<T> {
    private final Iterator<T> it;

    public MyIndexReader(
        final Iterator<MemoryStoreEntry> it,
        final GeoWaveRowIteratorTransformer<T> rowTransformer) {
      super();
      this.it = rowTransformer.apply(Iterators.transform(it, e -> e.row));
    }

    @Override
    public void close() {}

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

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

  private class MyIndexWriter<T> implements RowWriter {
    final String indexName;

    public MyIndexWriter(final String indexName) {
      super();
      this.indexName = indexName;
    }

    @Override
    public void close() throws IOException {}

    @Override
    public void flush() {
      try {
        close();
      } catch (final IOException e) {
        LOGGER.error("Error closing index writer", e);
      }
    }

    @Override
    public void write(final GeoWaveRow[] rows) {
      for (final GeoWaveRow r : rows) {
        write(r);
      }
    }

    @Override
    public void write(final GeoWaveRow row) {
      SortedSet<MemoryStoreEntry> rowTreeSet = storeData.get(indexName);
      if (rowTreeSet == null) {
        rowTreeSet = new TreeSet<>();
        storeData.put(indexName, rowTreeSet);
      }
      if (rowTreeSet.contains(new MemoryStoreEntry(row))) {
        rowTreeSet.remove(new MemoryStoreEntry(row));
      }
      if (!rowTreeSet.add(new MemoryStoreEntry(row))) {
        LOGGER.warn("Unable to add new entry");
      }
    }
  }

  private class MyIndexDeleter implements RowDeleter {
    private final String indexName;
    private final String[] authorizations;

    public MyIndexDeleter(final String indexName, final String... authorizations) {
      this.indexName = indexName;
      this.authorizations = authorizations;
    }

    @Override
    public void close() {}

    @Override
    public void delete(final GeoWaveRow row) {
      final MemoryStoreEntry entry = new MemoryStoreEntry(row);
      if (isAuthorized(entry, authorizations)) {
        final SortedSet<MemoryStoreEntry> rowTreeSet = storeData.get(indexName);
        if (rowTreeSet != null) {
          if (!rowTreeSet.remove(entry)) {
            LOGGER.warn("Unable to remove entry");
          }
        }
      }
    }

    @Override
    public void flush() {
      // Do nothing, delete is done immediately.
    }
  }

  public static class MemoryStoreEntry implements Comparable<MemoryStoreEntry> {
    private final GeoWaveRow row;

    public MemoryStoreEntry(final byte[] comparisonPartitionKey, final byte[] comparisonSortKey) {
      row =
          new GeoWaveRowImpl(
              new GeoWaveKeyImpl(
                  new byte[] {0},
                  (short) 0, // new byte[] {},
                  comparisonPartitionKey,
                  comparisonSortKey,
                  0),
              null);
    }

    public MemoryStoreEntry(final GeoWaveRow row) {
      this.row = row;
    }

    public GeoWaveRow getRow() {
      return row;
    }

    public byte[] getCompositeInsertionId() {
      return ((GeoWaveKeyImpl) ((GeoWaveRowImpl) row).getKey()).getCompositeInsertionId();
    }

    @Override
    public int compareTo(final MemoryStoreEntry other) {
      final int indexIdCompare =
          UnsignedBytes.lexicographicalComparator().compare(
              getCompositeInsertionId(),
              other.getCompositeInsertionId());
      if (indexIdCompare != 0) {
        return indexIdCompare;
      }
      final int dataIdCompare =
          UnsignedBytes.lexicographicalComparator().compare(
              row.getDataId(),
              other.getRow().getDataId());
      if (dataIdCompare != 0) {
        return dataIdCompare;
      }
      final int adapterIdCompare =
          UnsignedBytes.lexicographicalComparator().compare(
              ByteArrayUtils.shortToByteArray(row.getAdapterId()),
              ByteArrayUtils.shortToByteArray(other.getRow().getAdapterId()));
      if (adapterIdCompare != 0) {
        return adapterIdCompare;
      }
      return 0;
    }

    @Override
    public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = (prime * result) + ((row == null) ? 0 : row.hashCode());
      return result;
    }

    @Override
    public boolean equals(final Object obj) {
      if (this == obj) {
        return true;
      }
      if (obj == null) {
        return false;
      }
      if (getClass() != obj.getClass()) {
        return false;
      }
      final MemoryStoreEntry other = (MemoryStoreEntry) obj;
      if (row == null) {
        if (other.row != null) {
          return false;
        }
      }
      return compareTo(other) == 0;
    }
  }

  @Override
  public MetadataWriter createMetadataWriter(final MetadataType metadataType) {
    return new MyMetadataWriter<>(metadataType);
  }

  @Override
  public MetadataReader createMetadataReader(final MetadataType metadataType) {
    return new MyMetadataReader(metadataType);
  }

  @Override
  public MetadataDeleter createMetadataDeleter(final MetadataType metadataType) {
    return new MyMetadataDeleter(metadataType);
  }

  private class MyMetadataReader implements MetadataReader {
    protected final MetadataType type;

    public MyMetadataReader(final MetadataType type) {
      super();
      this.type = type;
    }

    @SuppressWarnings({"rawtypes", "unchecked"})
    @Override
    public CloseableIterator<GeoWaveMetadata> query(final MetadataQuery query) {
      final SortedSet<MemoryMetadataEntry> typeStore = metadataStore.get(type);
      if (typeStore == null) {
        return new CloseableIterator.Empty<>();
      }
      final SortedSet<MemoryMetadataEntry> set;
      if (query.hasPrimaryIdRanges()) {
        set =
            new TreeSet(
                Arrays.stream(query.getPrimaryIdRanges()).flatMap(
                    r -> typeStore.subSet(
                        new MemoryMetadataEntry(
                            new GeoWaveMetadata(r.getStart(), query.getSecondaryId(), null, null),
                            null),
                        new MemoryMetadataEntry(
                            new GeoWaveMetadata(
                                r.getEndAsNextPrefix(),
                                getNextPrefix(query.getSecondaryId()),
                                // this should be sufficient
                                new byte[] {
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF},
                                // this should be sufficient
                                new byte[] {
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF,
                                    (byte) 0xFF}),
                            new byte[] {
                                (byte) 0xFF,
                                (byte) 0xFF,
                                (byte) 0xFF,
                                (byte) 0xFF,
                                (byte) 0xFF,
                                (byte) 0xFF,
                                (byte) 0xFF})).stream()).collect(Collectors.toSet()));
      } else {
        set =
            typeStore.subSet(
                new MemoryMetadataEntry(
                    new GeoWaveMetadata(query.getPrimaryId(), query.getSecondaryId(), null, null),
                    null),
                new MemoryMetadataEntry(
                    new GeoWaveMetadata(
                        getNextPrefix(query.getPrimaryId()),
                        getNextPrefix(query.getSecondaryId()),
                        // this should be sufficient
                        new byte[] {
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF},
                        // this should be sufficient
                        new byte[] {
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF,
                            (byte) 0xFF}),
                    new byte[] {
                        (byte) 0xFF,
                        (byte) 0xFF,
                        (byte) 0xFF,
                        (byte) 0xFF,
                        (byte) 0xFF,
                        (byte) 0xFF,
                        (byte) 0xFF}));
      }
      Iterator<MemoryMetadataEntry> it = set.iterator();
      if ((query.getAuthorizations() != null) && (query.getAuthorizations().length > 0)) {
        it =
            Iterators.filter(
                it,
                input -> MemoryStoreUtils.isAuthorized(
                    input.getMetadata().getVisibility(),
                    query.getAuthorizations()));
      }
      final Iterator<GeoWaveMetadata> itTransformed =
          Iterators.transform(
              it,
              input -> new GeoWaveMetadataWithUUID(
                  input.metadata.getPrimaryId(),
                  input.metadata.getSecondaryId(),
                  input.metadata.getVisibility(),
                  input.metadata.getValue(),
                  input.uuidBytes));
      // convert to and from array just to avoid concurrent modification
      // issues on the iterator that is linked back to the metadataStore
      // sortedSet (basically clone the iterator, so for example deletes
      // can occur while iterating through this query result)
      final CloseableIterator<GeoWaveMetadata> converted =
          new MemoryMetadataFilteringIterator(
              new CloseableIterator.Wrapper(
                  Iterators.forArray(Iterators.toArray(itTransformed, GeoWaveMetadata.class))),
              query);
      if (type.isStatValues()) {
        return MetadataIterators.clientVisibilityFilter(converted, query.getAuthorizations());
      }
      return converted;
    }
  }

  private static final byte[] AMPRISAND = StringUtils.stringToBinary("&");

  private static byte[] combineVisibilities(final byte[] vis1, final byte[] vis2) {
    if ((vis1 == null) || (vis1.length == 0)) {
      return vis2;
    }
    if ((vis2 == null) || (vis2.length == 0)) {
      return vis1;
    }
    return ArrayUtils.addAll(ArrayUtils.addAll(vis1, AMPRISAND), vis2);
  }

  private static byte[] getNextPrefix(final byte[] bytes) {
    if (bytes == null) {
      // this is simply for memory data store test purposes and is just an
      // attempt to go to the end of the memory datastore table
      return new byte[] {
          (byte) 0xFF,
          (byte) 0xFF,
          (byte) 0xFF,
          (byte) 0xFF,
          (byte) 0xFF,
          (byte) 0xFF,
          (byte) 0xFF,};
    }
    return new ByteArray(bytes).getNextPrefix();
  }

  private class MyMetadataWriter<T> implements MetadataWriter {
    private final MetadataType type;

    public MyMetadataWriter(final MetadataType type) {
      super();
      this.type = type;
    }

    @Override
    public void close() throws IOException {}

    @Override
    public void flush() {
      try {
        close();
      } catch (final IOException e) {
        LOGGER.error("Error closing metadata writer", e);
      }
    }

    @Override
    public void write(final GeoWaveMetadata metadata) {
      SortedSet<MemoryMetadataEntry> typeStore = metadataStore.get(type);
      if (typeStore == null) {
        typeStore = new TreeSet<>();
        metadataStore.put(type, typeStore);
      }
      if (typeStore.contains(new MemoryMetadataEntry(metadata))) {
        typeStore.remove(new MemoryMetadataEntry(metadata));
      }
      if (!typeStore.add(new MemoryMetadataEntry(metadata))) {
        LOGGER.warn("Unable to add new metadata");
      }
    }
  }

  private class MyMetadataDeleter extends MyMetadataReader implements MetadataDeleter {
    public MyMetadataDeleter(final MetadataType type) {
      super(type);
    }

    @Override
    public void close() throws Exception {}

    @Override
    public boolean delete(final MetadataQuery query) {
      final List<GeoWaveMetadata> toRemove = new ArrayList<>();
      try (CloseableIterator<GeoWaveMetadata> it = query(query)) {
        while (it.hasNext()) {
          toRemove.add(it.next());
        }
      }
      for (final GeoWaveMetadata r : toRemove) {
        metadataStore.get(type).remove(
            new MemoryMetadataEntry(r, ((GeoWaveMetadataWithUUID) r).uuidBytes));
      }
      return true;
    }

    @Override
    public void flush() {}
  }

  public static class MemoryMetadataEntry implements Comparable<MemoryMetadataEntry> {
    private final GeoWaveMetadata metadata;
    // this is just to allow storing duplicates in the treemap
    private final byte[] uuidBytes;

    public MemoryMetadataEntry(final GeoWaveMetadata metadata) {
      this(metadata, UUID.randomUUID().toString().getBytes(StringUtils.getGeoWaveCharset()));
    }

    public MemoryMetadataEntry(final GeoWaveMetadata metadata, final byte[] uuidBytes) {
      this.metadata = metadata;
      this.uuidBytes = uuidBytes;
    }

    public GeoWaveMetadata getMetadata() {
      return metadata;
    }

    @Override
    public int compareTo(final MemoryMetadataEntry other) {
      final Comparator<byte[]> lexyWithNullHandling =
          Ordering.from(UnsignedBytes.lexicographicalComparator()).nullsFirst();
      final int primaryIdCompare =
          lexyWithNullHandling.compare(metadata.getPrimaryId(), other.metadata.getPrimaryId());
      if (primaryIdCompare != 0) {
        return primaryIdCompare;
      }
      final int secondaryIdCompare =
          lexyWithNullHandling.compare(metadata.getSecondaryId(), other.metadata.getSecondaryId());
      if (secondaryIdCompare != 0) {
        return secondaryIdCompare;
      }
      final int visibilityCompare =
          lexyWithNullHandling.compare(metadata.getVisibility(), other.metadata.getVisibility());
      if (visibilityCompare != 0) {
        return visibilityCompare;
      }
      // this is just to allow storing duplicates in the treemap
      return lexyWithNullHandling.compare(uuidBytes, other.uuidBytes);
    }

    @Override
    public int hashCode() {
      final int prime = 31;
      int result = 1;
      result = (prime * result) + ((metadata == null) ? 0 : metadata.hashCode());
      result = (prime * result) + Arrays.hashCode(uuidBytes);
      return result;
    }

    @Override
    public boolean equals(final Object obj) {
      if (this == obj) {
        return true;
      }
      if (obj == null) {
        return false;
      }
      if (getClass() != obj.getClass()) {
        return false;
      }
      final MemoryMetadataEntry other = (MemoryMetadataEntry) obj;
      if (metadata == null) {
        if (other.metadata != null) {
          return false;
        }
      }
      return compareTo(other) == 0;
    }
  }

  @Override
  public boolean metadataExists(final MetadataType type) throws IOException {
    return metadataStore.containsKey(type);
  }

  public static class GeoWaveMetadataWithUUID extends GeoWaveMetadata {
    byte[] uuidBytes;

    public GeoWaveMetadataWithUUID(
        final byte[] primaryId,
        final byte[] secondaryId,
        final byte[] visibility,
        final byte[] value,
        final byte[] uuidBytes) {
      super(primaryId, secondaryId, visibility, value);
      this.uuidBytes = uuidBytes;
    }

    @Override
    public boolean equals(final Object o) {
      if (this == o) {
        return true;
      }
      if ((o == null) || (getClass() != o.getClass())) {
        return false;
      }
      if (!super.equals(o)) {
        return false;
      }
      final GeoWaveMetadataWithUUID that = (GeoWaveMetadataWithUUID) o;
      return Arrays.equals(uuidBytes, that.uuidBytes);
    }

    @Override
    public int hashCode() {
      int result = super.hashCode();
      result = (31 * result) + Arrays.hashCode(uuidBytes);
      return result;
    }
  }
}


text:
using NUnit.Framework;
using System;
using System.Collections.Specialized;
using System.Web;
using Microsoft.Reporting.WebForms;

namespace MvcReportViewer.Tests
{
    [TestFixture]
    public class ReportViewerParametersParserTests
    {
        [SetUp]
        public void SetUp()
        {
            HttpContext.Current = new HttpContext(
                new HttpRequest(null, "http://tempuri.org", null),
                new HttpResponse(null));
        }

        [TearDown]
        public void TearDown()
        {
            HttpContext.Current = null;
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Parse_NullQueryString_RaisedArgumentNullException()
        {
            var parser = new ReportViewerParametersParser();
            parser.Parse(null);
        }

        [Test]
        [ExpectedException(typeof(MvcReportViewerException))]
        public void Parse_ParseWithoutQueryString_RaiseMvcReportViewerException()
        {
            var parser = new ReportViewerParametersParser();
            parser.Parse(new NameValueCollection());
        }

        [Test]
        [ExpectedException(typeof(MvcReportViewerException))]
        public void Parse_EmptyServerInQueryString_RaiseMvcReportViewerException()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            queryString.Add(UriParameters.ReportServerUrl, string.Empty);
            parser.Parse(queryString);
        }

        [Test]
        public void Parse_ParseWithoutQueryString_DefaultValuesAndReport()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            Assert.AreEqual(TestData.DefaultServer, parameters.ReportServerUrl);
            Assert.AreEqual(TestData.DefaultUsername, parameters.Username);
            Assert.AreEqual(TestData.DefaultPassword, parameters.Password);
            TestHelpers.PropertiesAreNull(parameters.ControlSettings);
            Assert.AreEqual(0, parameters.ReportParameters.Count);
        }

        [Test]
        public void Parse_HasServer_ServerAndRestFromAppConfig()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            queryString.Add(UriParameters.ReportServerUrl, TestData.Server);
            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            Assert.AreEqual(TestData.Server, parameters.ReportServerUrl);
            Assert.AreEqual(TestData.DefaultUsername, parameters.Username);
            Assert.AreEqual(TestData.DefaultPassword, parameters.Password);
            TestHelpers.PropertiesAreNull(parameters.ControlSettings);
            Assert.AreEqual(0, parameters.ReportParameters.Count);
        }

        [Test]
        public void Parse_HasServerUsername_ServerUsernameEmptyPasswordAndRestFromAppConfig()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            queryString.Add(UriParameters.ReportServerUrl, TestData.Server);
            queryString.Add(UriParameters.Username, TestData.Username);
            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            Assert.AreEqual(TestData.Server, parameters.ReportServerUrl);
            Assert.AreEqual(TestData.Username, parameters.Username);
            Assert.AreEqual(string.Empty, parameters.Password);
            TestHelpers.PropertiesAreNull(parameters.ControlSettings);
            Assert.AreEqual(0, parameters.ReportParameters.Count);
        }

        [Test]
        public void Parse_HasServerUsernamePassword_ServerUsernamePasswordAndRestFromAppConfig()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            queryString.Add(UriParameters.ReportServerUrl, TestData.Server);
            queryString.Add(UriParameters.Username, TestData.Username);
            queryString.Add(UriParameters.Password, TestData.Password);
            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            Assert.AreEqual(TestData.Server, parameters.ReportServerUrl);
            Assert.AreEqual(TestData.Username, parameters.Username);
            Assert.AreEqual(TestData.Password, parameters.Password);
            TestHelpers.PropertiesAreNull(parameters.ControlSettings);
            Assert.AreEqual(0, parameters.ReportParameters.Count);
        }

        [Test]
        public void Parse_HasServerUsernamePasswordPromptsFalse_AllFromQueryString()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            queryString.Add(UriParameters.ReportServerUrl, TestData.Server);
            queryString.Add(UriParameters.Username, TestData.Username);
            queryString.Add(UriParameters.Password, TestData.Password);

            // Set ReportViewer UI options

            queryString.Add(TestData.BackColor, TestData.BackColorArgbValue.ToString());
            queryString.Add(TestData.ShowParameterPrompts, TestData.ShowParameterPromptsValue.ToString());
            queryString.Add(TestData.ToolBarItemBorderStyle, TestData.ToolBarItemBorderStyleValue.ToString());
            queryString.Add(TestData.ToolBarItemBorderWidth, TestData.ToolBarItemBorderWidthValue.ToString());
            queryString.Add(TestData.ZoomMode, TestData.ZoomModeValue.ToString());
            queryString.Add(TestData.ZoomPercent, TestData.ZoomPercentValue.ToString());
            queryString.Add(TestData.HyperlinkTarget, TestData.HyperlinkTargetValue);

            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            Assert.AreEqual(TestData.Server, parameters.ReportServerUrl);
            Assert.AreEqual(TestData.Username, parameters.Username);
            Assert.AreEqual(TestData.Password, parameters.Password);

            // Validate ReportViewer UI options

            TestHelpers.PropertiesAreNull(
                parameters.ControlSettings,
                "BackColor",
                "ShowParameterPrompts",
                "ToolBarItemBorderStyle",
                "ToolBarItemBorderWidth",
                "ZoomMode",
                "ZoomPercent",
                "HyperlinkTarget");

            Assert.AreEqual(
                TestData.BackColorArgbValue,
                parameters.ControlSettings.BackColor.Value.ToArgb());

            Assert.AreEqual(
                TestData.ShowParameterPromptsValue,
                parameters.ControlSettings.ShowParameterPrompts.Value);

            Assert.AreEqual(
                TestData.ToolBarItemBorderStyleValue,
                parameters.ControlSettings.ToolBarItemBorderStyle.Value);

            Assert.AreEqual(
                TestData.ToolBarItemBorderWidthValue,
                parameters.ControlSettings.ToolBarItemBorderWidth.Value);

            Assert.AreEqual(
                TestData.ZoomModeValue,
                parameters.ControlSettings.ZoomMode.Value);

            Assert.AreEqual(
                TestData.ZoomPercentValue,
                parameters.ControlSettings.ZoomPercent.Value);

            Assert.AreEqual(
                TestData.HyperlinkTargetValue,
                parameters.ControlSettings.HyperlinkTarget);

            Assert.AreEqual(0, parameters.ReportParameters.Count);
        }

        [Test]
        public void Parse_EachTypeParameter_AllParametersHaveRightValuesAndDataTypes()
        {
            var parser = new ReportViewerParametersParser();
            var queryString = GetQueryString();
            PrepareTestReportParameters(queryString);
            var parameters = parser.Parse(queryString);
            Assert.AreEqual(TestData.ReportName, parameters.ReportPath);
            var errors = TestHelpers.ValidateReportParameters(parameters);
            if (!string.IsNullOrEmpty(errors))
            {
                Assert.Fail(errors);
            }
        }

        private NameValueCollection GetQueryString()
        {
            var queryString = new NameValueCollection {
                { UriParameters.ReportPath, TestData.ReportName },
                { UriParameters.ProcessingMode, ProcessingMode.Remote.ToString() }
            };

            return queryString;
        }

        private void PrepareTestReportParameters(NameValueCollection queryString)
        {
            foreach (var parameter in TestData.ExprectedParameters)
            {
                queryString.Add(parameter.Key, parameter.Value);
            }
        }
    }
}


text:
namespace Invaders.Tests.Corectness
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System;
    using System.Collections.Generic;
    using System.Linq;

    [TestClass]
    public class TestDestroyInRadius
    {
        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_NoTargets()
        {
            Computer computer = new Computer(100);

            computer.DestroyTargetsInRadius(100);

            CollectionAssert.AreEqual(new List<Invader>(), computer.Invaders().ToList(), "Collections not equal");
        }

        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_OneTarget()
        {
            Computer computer = new Computer(100);

            computer.AddInvader(new Invader(1, 1));

            computer.DestroyTargetsInRadius(100);

            CollectionAssert.AreEqual(new List<Invader>(), computer.Invaders().ToList(), "Collections not equal");
        }

        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_AllTargets()
        {
            Computer computer = new Computer(100);

            for (int i = 0; i < 100; i++)
            {
                computer.AddInvader(new Invader(i, i));
            }

            computer.DestroyTargetsInRadius(100);

            CollectionAssert.AreEqual(new List<Invader>(), computer.Invaders().ToList(), "Collections not equal");
        }

        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_TargetOutOfReach_ShouldNotDestroy()
        {
            Computer computer = new Computer(100);
            List<Invader> actual = new List<Invader>();
            Invader invader = new Invader(10, 10);

            computer.AddInvader(invader);
            actual.Add(invader);

            computer.DestroyTargetsInRadius(9);

            CollectionAssert.AreEqual(actual, computer.Invaders().ToList(), "Collections not equal");
        }

        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_MultipleTargets_ShouldDestroyInRadius()
        {
            Computer computer = new Computer(100);
            List<Invader> actual = new List<Invader>();

            for (int i = 1; i <= 100; i++)
            {
                Invader invader = new Invader(i, i);
                computer.AddInvader(invader);
                if (i > 50)
                {
                    actual.Add(invader);
                }
            }

            computer.DestroyTargetsInRadius(50);

            CollectionAssert.AreEqual(actual, computer.Invaders().ToList(), "Collections not equal");
        }

        [TestMethod]
        [Timeout(200)]
        public void DestroyInRadius_MultipleRandomTargets_ShouldDestroyInRadius()
        {
            Computer computer = new Computer(100);
            List<Invader> actual = new List<Invader>();
            Random rnd = new Random();

            for (int i = 1; i <= 1000; i++)
            {
                int distance = rnd.Next(100);
                Invader invader = new Invader(0, distance);
                computer.AddInvader(invader);
                if (distance > 50)
                {
                    actual.Add(invader);
                }
            }

            computer.DestroyTargetsInRadius(50);

            CollectionAssert.AreEqual(actual, computer.Invaders().ToList(), "Collections not equal");
        }
    }
}


text: Для просмотра дополнительной информации о процессах Unix, нажмите здесь.


text:
package hu.belicza.andras.sc2gears.sc2replay.model;

import hu.belicza.andras.sc2gearspluginapi.api.sc2replay.IMessageEvents;
import hu.belicza.andras.sc2gearspluginapi.impl.util.IntHolder;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * Contains information from chat messages and other non-game impact commands.
 *
 *
For format description see:
 *

Starcraft 2 Replay

 *
 * @author Andras Belicza
 */
public class MessageEvents implements IMessageEvents {

	/** Op code indicating a chat message to all.       */
	public static final byte OP_CODE_CHAT_TO_ALL       = (byte) 0x00;
	/** Op code indicating a chat message to allies.    */
	public static final byte OP_CODE_CHAT_TO_ALLIES    = (byte) 0x02;
	/** Op code indicating a chat message to observers. */
	public static final byte OP_CODE_CHAT_TO_OBSERVERS = (byte) 0x04;
	/** Op code indicating a sync message.              */
	public static final byte OP_CODE_SYNC              = (byte) 0x80; // Maybe this is System message with parameters: short, short messageID
	/** Op code indicating a blink (minimap ping).      */
	public static final byte OP_CODE_BLINK             = (byte) 0x83;

	/**
	 * Represents a general message.
	 * @author Andras Belicza
	 */
	public static class Message implements IMessage {
		public final int  time;  // time since the last message in ms
		public final int  client;
		public final byte opCode;

		public Message( final int time, final int client, final byte opCode ) {
			this.time   = time;
			this.client = client;
			this.opCode = opCode;
		}

		@Override
		public int getDeltaTime() {
			return time;
		}

		@Override
		public int getClient() {
			return client;
		}
	}

	/**
	 * Represents a text message.
	 * @author Andras Belicza
	 */
	public static class Text extends Message implements IText {
		public String text;

		public Text( final int time, final int client, final byte opCode ) {
			super( time, client, opCode );
		}

		@Override
		public String toString() {
			return "Player " + client + " at " + time + " to " + ( opCode == OP_CODE_CHAT_TO_ALL ? "all: " : opCode == OP_CODE_CHAT_TO_ALLIES ? "allies: " : opCode == OP_CODE_CHAT_TO_OBSERVERS ? "observers: " : "unknown: " ) + text;
		}

		@Override
		public String getText() {
			return text;
		}
	}

	/**
	 * Represents a blink (minimap ping).
	 * @author Andras Belicza
	 */
	public static class Blink extends Message implements IBlink {
		public int x;
		public int y;

		public Blink( final int time, final int client ) {
			super( time, client, OP_CODE_BLINK );
		}

		@Override
		public String toString() {
			return String.format( Locale.ENGLISH, "Player %s pinged at %d: %.1f,%.1f", client, time, getNormalizedX(), getNormalizedY() );
		}

		@Override
		public int getX() {
			return x;
		}

		@Override
		public int getY() {
			return y;
		}

		@Override
		public float getNormalizedX() {
			return x / 65536;
		}

		@Override
		public float getNormalizedY() {
			return y / 65536f;
		}
	}

	public Message[] messages;

	private Map< String, IntHolder >[] wordCountMaps;

	/**
	 * Returns the array of word count maps.

	 * The index is the player (client) index, the map key is the word, the value is the word count.
	 * @param clientsCount number of clients to count words for
	 * @return the word count maps
	 */
	@Override
	@SuppressWarnings("unchecked")
	public Map< String, IntHolder >[] getWordCountMaps( final int clientsCount ) {
		if ( ( wordCountMaps == null || wordCountMaps.length != clientsCount ) && messages != null ) { // messages can be null if replay was constructed from specification or loaded from cache
			wordCountMaps = new Map[ clientsCount ];

			IntHolder count;
			for ( final Message message : messages )
				if ( message instanceof Text )
					for ( final StringTokenizer stringTokenizer = new StringTokenizer( ( (Text) message ).text ); stringTokenizer.hasMoreTokens(); ) {
						final String word = stringTokenizer.nextToken().toLowerCase();

						if ( wordCountMaps[ message.client ] == null )
							wordCountMaps[ message.client ] = new HashMap< String, IntHolder >();

						if ( ( count = wordCountMaps[ message.client ].get( word ) ) == null )
							wordCountMaps[ message.client ].put( word, count = new IntHolder( 1 ) );
						else
							count.value++;
					}
		}

		return wordCountMaps;
	}

	/**
	 * Sets the word count maps.
	 * @param wordCountMaps word count maps to be set
	 */
	public void setWordCountMaps( final Map< String, IntHolder >[] wordCountMaps ) {
		this.wordCountMaps = wordCountMaps;
	}

	@Override
	public IMessage[] getMessages() {
		return messages;
	}

}


text:
<?php

namespace Mopa\Bundle\RemoteUpdateBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;

/**
 * This is the class that loads and manages your bundle configuration
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
 */
class MopaRemoteUpdateExtension extends Extension {
    /**
     * {@inheritDoc}
     */
    public function load(array $configs, ContainerBuilder $container) {
        $configuration = new Configuration();
        $config = $this->processConfiguration($configuration, $configs);

        $loader = new Loader\YamlFileLoader($container,
            new FileLocator(__DIR__ . '/../Resources/config'));
        $loader->load('services.yml');
        $container
            ->setParameter('mopa_remote_update.composer', $config['composer']);
        // register filters
        foreach ($config['remotes'] as $name => $conf) {
            $container
                ->setParameter('mopa_remote_update.remotes.' . $name, $conf);
        }

    }
}


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

<!--     <style name="Theme.Gast" parent="@android:Theme"></style> -->
<!--     <style name="Theme.Gast" parent="@android:style/Theme.Holo"></style> -->

	<style name="apptext">
		<item name="android:textSize">12sp</item>
		<item name="android:layout_width">match_parent</item>
		<item name="android:layout_height">wrap_content</item>
	</style>

	<style name="appspeechresulttext" parent="apptext">
		<item name="android:textColor">@color/normal_black</item>
	</style>

	<style name="appbutton" parent="apptext">
	</style>

	<style name="dropdownbutton" parent="appbutton">
		<item name="android:src">@drawable/arrow_down_float</item>
		<item name="android:scaleType">center</item>
	</style>

	<style name="appbuttoninlist" parent="apptext">
		<item name="android:padding">5dip</item>
	</style>

	<style name="line_separator">
		<item name="android:layout_width">fill_parent</item>
		<item name="android:layout_height">2dip</item>
		<item name="android:color">@color/gray</item>
		<item name="android:background">@color/gray</item>
	</style>

<!-- 	<style name="left_toolbar_fragment"> -->
<!-- 		<item name="android:layout_width">150dip</item> -->
<!-- 		<item name="android:layout_height">fill_parent</item> -->
<!-- 		<item name="android:layout_alignParentLeft">true</item> -->
<!-- 	</style> -->

<!-- 	<style name="right_toolbar_fragment"> -->
<!-- 		<item name="android:layout_width">150dip</item> -->
<!-- 		<item name="android:layout_height">fill_parent</item> -->
<!-- 		<item name="android:layout_alignParentRight">true</item> -->
<!-- 	</style> -->
<!-- 				<TextView -->
<!-- 				android:layout_width="fill_parent" -->
<!-- 				android:layout_height="1dip" -->
<!-- 				android:background="@android:color/darker_gray"/> -->

</resources>


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <ImageView
    android:id="@+id/iv_icon"
    android:layout_width="120dp"
    android:layout_height="120dp" />

    <TextView
        android:id="@+id/tv_name"
        style="@style/search_result_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:gravity="center_horizontal"
        android:singleLine="true"
        android:text="红外传感器" />

</LinearLayout>


text:
package org.apache.ignite.examples.datagrid;

import org.apache.ignite.*;

import java.util.*;

/**
 * This example demonstrates very basic operations on cache, such as 'put' and 'get'.
 *

 * Remote nodes should always be started with special configuration file which
 * enables P2P class loading: {@code 'ignite.{sh|bat} examples/config/example-cache.xml'}.
 *

 * Alternatively you can run {@link CacheNodeStartup} in another JVM which will
 * start node with {@code examples/config/example-cache.xml} configuration.
 */
public class CachePutGetExample {
    /** Cache name. */
    private static final String CACHE_NAME = "partitioned";

    /**
     * Executes example.
     *
     * @param args Command line arguments, none required.
     * @throws IgniteException If example execution failed.
     */
    public static void main(String[] args) throws IgniteException {
        try (Ignite ignite = Ignition.start("examples/config/example-cache.xml")) {
            // Clean up caches on all nodes before run.
            ignite.jcache(CACHE_NAME).clear();

            // Individual puts and gets.
            putGet();

            // Bulk puts and gets.
            putAllGetAll();
        }
    }

    /**
     * Execute individual puts and gets.
     *
     * @throws IgniteException If failed.
     */
    private static void putGet() throws IgniteException {
        System.out.println();
        System.out.println(">>> Cache put-get example started.");

        Ignite ignite = Ignition.ignite();

        final IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME);

        final int keyCnt = 20;

        // Store keys in cache.
        for (int i = 0; i < keyCnt; i++)
            cache.put(i, Integer.toString(i));

        System.out.println(">>> Stored values in cache.");

        for (int i = 0; i < keyCnt; i++)
            System.out.println("Got [key=" + i + ", val=" + cache.get(i) + ']');
    }

    /**
     * Execute bulk {@code putAll(...)} and {@code getAll(...)} operations.
     *
     * @throws IgniteException If failed.
     */
    private static void putAllGetAll() throws IgniteException {
        System.out.println();
        System.out.println(">>> Starting putAll-getAll example.");

        Ignite ignite = Ignition.ignite();

        final IgniteCache<Integer, String> cache = ignite.jcache(CACHE_NAME);

        final int keyCnt = 20;

        // Create batch.
        Map<Integer, String> batch = new HashMap<>();

        for (int i = 0; i < keyCnt; i++)
            batch.put(i, "bulk-" + Integer.toString(i));

        // Bulk-store entries in cache.
        cache.putAll(batch);

        System.out.println(">>> Bulk-stored values in cache.");

        // Bulk-get values from cache.
        Map<Integer, String> vals = cache.getAll(batch.keySet());

        for (Map.Entry<Integer, String> e : vals.entrySet())
            System.out.println("Got entry [key=" + e.getKey() + ", val=" + e.getValue() + ']');
    }
}


text:
from sys import argv

#add strikes mode = 1
#subtract strikes mode = -1
mode = argv[1]
oses = argv[2:]

for osis in oses:
        with open('strikes.txt', 'r') as f:
                strike_dict = eval(f.read())
                if osis not in strike_dict:
                        strike_dict[osis] = 0
                strike_dict[osis] += int(mode)
                if strike_dict[osis] <= 0:
                        del strike_dict[osis]
        with open('strikes.txt', 'w') as f:
                f.write(repr(strike_dict))


text:
package br.ufrj.dcc.convexhull.model;

import static br.ufrj.dcc.convexhull.model.ConvexHull.IS_FIRST_HALF;
import static br.ufrj.dcc.convexhull.model.ConvexHull.IS_NOT_FIRST_HALF;
import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;

import org.junit.Test;

public class ConvexHullUnitTest
{
	@Test
	public void getAllPossibleLines() throws Exception
	{
		Point a = new Point(1.0, 1.0);
		Point b = new Point(1.0, 2.0);
		Point c = new Point(2.0, 2.0);
		Point d = new Point(5.0, 3.0);
		Point e = new Point(3.0, 4.0);
		Point f = new Point(1.0, 4.0);
		Point g = new Point(2.0, 5.0);

		List<Point> points = new ArrayList<Point>();
		points.addAll(asList(a, b, c, d, e, f, g));

		Set<LineSegment> result = ConvexHull.getAllPossibleLineSegment(points);

		assertEquals(21, result.size());
	}

	@Test
	public void splitSet() throws Exception
	{
		Point a = new Point(1.0, 1.0);
		Point b = new Point(2.0, 2.0);
		Point c = new Point(3.0, 3.0);
		Point d = new Point(4.0, 4.0);

		List<Point> points = new ArrayList<Point>();
		points.addAll(asList(a, b, c, d));

		List<Point> firstHalf = ConvexHull.splitSet(points, IS_FIRST_HALF);
		List<Point> secondHalf = ConvexHull.splitSet(points, IS_NOT_FIRST_HALF);

		assertEquals(firstHalf.size(), 2);
		assertEquals(secondHalf.size(), 2);
		assertFalse(secondHalf.containsAll(firstHalf));
	}

	@Test
	public void splitSet_oddQuantityOfPoints() throws Exception
	{
		Point a = new Point(1.0, 1.0);
		Point b = new Point(2.0, 2.0);
		Point c = new Point(3.0, 3.0);

		List<Point> points = new ArrayList<Point>();
		points.addAll(asList(a, b, c));

		List<Point> firstHalf = ConvexHull.splitSet(points, IS_FIRST_HALF);
		List<Point> secondHalf = ConvexHull.splitSet(points, IS_NOT_FIRST_HALF);

		assertEquals(firstHalf.size(), 1);
		assertEquals(secondHalf.size(), 2);
		assertFalse(secondHalf.containsAll(firstHalf));
	}

	@Test
	public void findLowerTangent() throws Exception
	{
		Point a = new Point(0.0, 0.0);
		Point b = new Point(5.0, 0.0);
		Point c = new Point(5.0, 5.0);
		Point d = new Point(0.0, 5.0);

		List<Point> firstConvexHull = Arrays.asList(a, b, c, d);

		Point e = new Point(10.0, 0.0);
		Point f = new Point(15.0, 0.0);
		Point g = new Point(15.0, 5.0);
		Point h = new Point(10.0, 5.0);

		List<Point> secondConvexHull = Arrays.asList(e, f, g, h);

		ConvexHull.sortPointsClockwiseOrder(firstConvexHull);
		ConvexHull.sortPointsCounterClockwiseOrder(secondConvexHull);

		LineSegment lowerTangent = ConvexHull.findLowerTangent(firstConvexHull, secondConvexHull);

		assertEquals(b, lowerTangent.a());
		assertEquals(e, lowerTangent.b());
	}

	@Test
	public void findUpperTangent() throws Exception
	{
		Point a = new Point(0.0, 0.0);
		Point b = new Point(5.0, 0.0);
		Point c = new Point(5.0, 5.0);
		Point d = new Point(0.0, 5.0);

		List<Point> firstConvexHull = Arrays.asList(a, b, c, d);

		Point e = new Point(10.0, 0.0);
		Point f = new Point(15.0, 0.0);
		Point g = new Point(15.0, 5.0);
		Point h = new Point(10.0, 5.0);

		List<Point> secondConvexHull = Arrays.asList(e, f, g, h);

		ConvexHull.sortPointsClockwiseOrder(firstConvexHull);
		ConvexHull.sortPointsCounterClockwiseOrder(secondConvexHull);

		LineSegment upperTangent = ConvexHull.findUpperTangent(firstConvexHull, secondConvexHull);

		assertEquals(c, upperTangent.a());
		assertEquals(h, upperTangent.b());
	}

	@Test
	public void getCenterPoint() throws Exception
	{
		Point a = new Point(0.0, 0.0);
		Point b = new Point(5.0, 0.0);
		Point c = new Point(5.0, 5.0);
		Point d = new Point(0.0, 5.0);
		List<Point> points = Arrays.asList(a, b, c, d);

		Point center = ConvexHull.getCenterPoint(points);

		assertEquals(new Point(2.5, 2.5), center);
	}

	@Test
	public void sortPointsClockwiseOrder() throws Exception
	{
		Point a = new Point(0.0, 0.0);
		Point b = new Point(5.0, 0.0);
		Point c = new Point(5.0, 5.0);
		Point d = new Point(0.0, 5.0);
		List<Point> points = Arrays.asList(a, b, c, d);

		ConvexHull.sortPointsClockwiseOrder(points);

		assertEquals(d, points.get(0));
		assertEquals(c, points.get(1));
		assertEquals(b, points.get(2));
		assertEquals(a, points.get(3));
	}
}