text:
<?php

return [
    'test' => 'recursive/recursive/test_file.php',
];

redpajama_set_name: RedPajamaGithub


text:
package pl.edu.pw.okno.custom.ui;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

import com.codename1.io.Log;
import com.codename1.ui.Button;
import com.codename1.ui.Calendar;

import pl.edu.pw.okno.page.Properties;
import pl.edu.pw.okno.resource.Event;
import pl.edu.pw.okno.resource.EventDto;
import pl.edu.pw.okno.utils.CalendarUtils;

public class EventsCalendar extends Calendar {

	private List<EventDto> events = new ArrayList<EventDto>();
	Map<java.util.Calendar, List<EventDto>> eventsOfMonth = new HashMap<>();
	private String lastVisitedMonth = "";

	public EventsCalendar() {
		super();
	}

	public EventsCalendar(long time) {
		super(time);
	}

	public EventsCalendar(long time, TimeZone tmz) {
		super(time, tmz);
	}

	public void fetchOnCalendarChange(int year, int month, int day) {
		String currentMonth = Integer.toString(year) + "." + Integer.toString(month);
		if ((lastVisitedMonth == null) || !lastVisitedMonth.equals(currentMonth)) {
			eventsOfMonth = new HashMap<>();
			fetchData(year, month, day);
			lastVisitedMonth = currentMonth;
		}
	}

	private void fetchData(int year, int month, int day) {
		try {
			java.util.Calendar calendar = java.util.Calendar.getInstance();
			calendar.set(java.util.Calendar.YEAR, year);
			calendar.set(java.util.Calendar.MONTH, month);
			calendar.set(java.util.Calendar.DAY_OF_MONTH, 1);
			Event event = new Event(Properties.getInstance().getUrl(), calendar);
			//Display.getInstance().callSeriallyAndWait(() -> event.requestFor());
			event.requestFor();
        	events = event.getResults();
        	Log.p("Events: " + events, Log.DEBUG);
        } catch(Exception ex) {
        	ex.printStackTrace();
        }
	}

	@Override
    protected Button createDay() {
        //Customize your button here
        Button day = new Button();
        day.setAlignment(CENTER);
        day.setUIID("CalendarDay");
        day.setEndsWith3Points(false);
        day.setTickerEnabled(false);
        return day;
    }

	@Override
    protected void updateButtonDayDate(Button dayButton, int year, int month, int day) {
        //Customize day values
		fetchOnCalendarChange(year, month, day);
		int counter = 0;
		for (EventDto event : events) {
			java.util.Calendar calendarStart = java.util.Calendar.getInstance();
			calendarStart.setTime(event.getStartDate());
			java.util.Calendar calendarEnd = java.util.Calendar.getInstance();
			calendarEnd.setTime(event.getEndDate());

			if (CalendarUtils.isWithinYears(year, calendarStart, calendarEnd)
				||
				CalendarUtils.isToThisDayOrLater(year, month, day, calendarStart, calendarEnd)
				||
				CalendarUtils.isFromThisDayOrBefore(year, month, day, calendarStart, calendarEnd)
				) {
					counter += 1;
					java.util.Calendar date = CalendarUtils.resetHourMinSecMill(null);
					date.set(java.util.Calendar.DAY_OF_MONTH, day);
					date.set(java.util.Calendar.MONTH, month);
					date.set(java.util.Calendar.YEAR, year);

					List<EventDto> eventsInDay = this.eventsOfMonth.get(date);
					if (eventsInDay == null) {
						this.eventsOfMonth.put(date, eventsInDay=new ArrayList<>());
					}
					eventsInDay.add(event);
				}
		}
		String decor = "";
		if(counter > 0) {
			decor = "*";
		}
		dayButton.setText(day+decor);
    }

	public Map<java.util.Calendar, List<EventDto>> getEventsOfMonth() {
		return eventsOfMonth;
	}

	public static class VisitedDate {

		private Integer year = null;
		private Integer month = null;
		private Integer day = null;

		public VisitedDate() {
		}

		public VisitedDate(int year, int month, int day) {
			this.year = year;
			this.month = month;
			this.day = day;
		}

		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;

			VisitedDate other = (VisitedDate) obj;
			return (year.equals(other.year) &&
					month.equals(other.month));
		}

	}

}


text:
{{<govuk_template}}

{{$head}}
  {{>includes/head}}
{{/head}}

{{$propositionHeader}}
  {{>includes/propositional_navigation}}
{{/propositionHeader}}

{{$headerClass}}with-proposition{{/headerClass}}

{{$content}}

	{{>includes/phase_banner}}

			<form action="declaration" method="#" class="form">

				Back

				Your day-to-day life - making decisions about money

				<fieldset class="inline">

					<legend class="form-label-bold add-padding" for="communicating">Do you need help to make decisions about spending and managing your money?</legend>

							<input id="communicating-yes" type="radio" name="communicating" value="Yes">
							Yes

							<input id="communicating-no" type="radio" name="communicating" value="No">
							No

				</fieldset>

					<fieldset class="inline">

							<legend class="form-label-bold" for="aids-appliances">Do you need someone else to help you to understand how much things cost when you buy them or how much change you receive?</legend>

								<input id="aids-appliances-yes" type="radio" name="aids-appliances" value="Yes">
								Yes

								<input id="aids-appliances-no" type="radio" name="aids-appliances" value="No">
								No

							Tell us about the type of help that you need and how often you need it.
							<textarea type="text" class="form-control-3-4" id="aids-appliances-details-box"></textarea>

					</fieldset>

					<fieldset class="inline">

							Do you need someone else to help you to manage your household budgets, pay bills or plan future purchases?

								<input id="another-person-yes" type="radio" name="another-person" value="Yes">
								Yes

								<input id="another-person-no" type="radio" name="another-person" value="No">
								No

							Tell us more about the help you need to manage your household budgets and how often you need it.
							<textarea type="text" class="form-control-3-4" id="another-person-details-box"></textarea>

					</fieldset>

						Tell us more about the difficulties you have managing money.
						<textarea type="text" class="form-control-3-4" id="communicate-other"></textarea>

					<input type="submit" class="button" value="Continue">

				<button class="button">Save</button>

			</form>

{{/content}}

{{$bodyEnd}}
{{>includes/elements_scripts}}
{{/bodyEnd}}

{{/govuk_template}}


text:
layout: default
title: Startup Threads
permalink: /threads/
excerpt: "Intersting threads from twitter."
---

    {% for thread in site.threads %}

    {% endfor %}


text:
void test01()
{
  using namespace std;
  bool test __attribute__((unused)) = true;

  wistringstream ist(L"the lamb lies down on broadway");
  wios::pos_type pos = ist.tellg();
  ist.ignore(4);
  int count1 = ist.gcount();
  ist.seekg(pos);
  int count2 = ist.gcount();
  VERIFY( count1 == count2 );
  ist.seekg(wios::off_type(pos), wios::beg);
  count2 = ist.gcount();
  VERIFY( count1 == count2 );
}

int main()
{
  test01();
  return 0;
}


text:
using Newtonsoft.Json;

namespace NewYorkWeather.Services.WeatherService.WeatherClient.Models
{
    public class Observation
    {
        [JsonProperty("date")]
        public Date Date { get; set; }

        [JsonProperty("utcdate")]
        public Date UTCDate { get; set; }

        [JsonProperty("tempm")]
        public string TemperatureM { get; set; }

        [JsonProperty("tempi")]
        public string TemperatureI { get; set; }

		//other fields ... For more go to https://www.wunderground.com/weather/api/d/docs?d=data/history#observations
	}
}


text:
.class final Landroid/app/Instrumentation$ActivityGoing;
.super Ljava/lang/Object;
.source "Instrumentation.java"

# interfaces
.implements Landroid/os/MessageQueue$IdleHandler;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/app/Instrumentation;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x12
    name = "ActivityGoing"
.end annotation

# instance fields
.field private final mWaiter:Landroid/app/Instrumentation$ActivityWaiter;

.field final synthetic this$0:Landroid/app/Instrumentation;

# direct methods
.method public constructor <init>(Landroid/app/Instrumentation;Landroid/app/Instrumentation$ActivityWaiter;)V
    .locals 0
    .parameter
    .parameter "waiter"

    .prologue
    .line 1726
    iput-object p1, p0, Landroid/app/Instrumentation$ActivityGoing;->this$0:Landroid/app/Instrumentation;

    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    .line 1727
    iput-object p2, p0, Landroid/app/Instrumentation$ActivityGoing;->mWaiter:Landroid/app/Instrumentation$ActivityWaiter;

    .line 1728
    return-void
.end method

# virtual methods
.method public final queueIdle()Z
    .locals 3

    .prologue
    .line 1731
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityGoing;->this$0:Landroid/app/Instrumentation;

    #getter for: Landroid/app/Instrumentation;->mSync:Ljava/lang/Object;
    invoke-static {v0}, Landroid/app/Instrumentation;->access$200(Landroid/app/Instrumentation;)Ljava/lang/Object;

    move-result-object v1

    monitor-enter v1

    .line 1732
    :try_start_0
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityGoing;->this$0:Landroid/app/Instrumentation;

    #getter for: Landroid/app/Instrumentation;->mWaitingActivities:Ljava/util/List;
    invoke-static {v0}, Landroid/app/Instrumentation;->access$300(Landroid/app/Instrumentation;)Ljava/util/List;

    move-result-object v0

    iget-object v2, p0, Landroid/app/Instrumentation$ActivityGoing;->mWaiter:Landroid/app/Instrumentation$ActivityWaiter;

    invoke-interface {v0, v2}, Ljava/util/List;->remove(Ljava/lang/Object;)Z

    .line 1733
    iget-object v0, p0, Landroid/app/Instrumentation$ActivityGoing;->this$0:Landroid/app/Instrumentation;

    #getter for: Landroid/app/Instrumentation;->mSync:Ljava/lang/Object;
    invoke-static {v0}, Landroid/app/Instrumentation;->access$200(Landroid/app/Instrumentation;)Ljava/lang/Object;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 1734
    monitor-exit v1

    .line 1735
    const/4 v0, 0x0

    return v0

    .line 1734
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
package com.sforce.ws.transport;

import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.*;
import java.util.Map.Entry;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

import com.sforce.ws.*;
import com.sforce.ws.tools.VersionInfo;
import com.sforce.ws.util.Base64;
import com.sforce.ws.util.FileUtil;

/**
 * This class is an implementation of Transport using the build in
 * JDK URLConnection.
 *
 * @author http://cheenath.com
 * @version 1.0
 * @since 1.0  Nov 30, 2005
 */
public class JdkHttpTransport implements Transport {
    private HttpURLConnection connection;
    private boolean successful;
    private ConnectorConfig config;
	private URL url;

    public JdkHttpTransport() {
    }

    public JdkHttpTransport(ConnectorConfig config) {
        setConfig(config);
    }

    @Override
    public void setConfig(ConnectorConfig config) {
        this.config = config;
    }

    @Override
    public OutputStream connect(String uri, HashMap<String, String> httpHeaders) throws IOException {
        return connectLocal(uri, httpHeaders, true);
    }

    @Override
    public OutputStream connect(String uri, HashMap<String, String> httpHeaders, boolean enableCompression)
            throws IOException {
        return connectLocal(uri, httpHeaders, enableCompression);
    }

    @Override
    public OutputStream connect(String uri, String soapAction) throws IOException {
        if (soapAction == null) {
            soapAction = "";
        }

        HashMap<String, String> header = new HashMap<String, String>();

        header.put("SOAPAction", "\"" + soapAction + "\"");
        header.put("Content-Type", "text/xml; charset=UTF-8");
        header.put("Accept", "text/xml");

        return connectLocal(uri, header);
    }

    private OutputStream connectLocal(String uri, HashMap<String, String> httpHeaders) throws IOException {
        return connectLocal(uri, httpHeaders, true);
    }

    private OutputStream connectLocal(String uri, HashMap<String, String> httpHeaders, boolean enableCompression)
            throws IOException {
        return wrapOutput(connectRaw(uri, httpHeaders, enableCompression), enableCompression);
    }

    private OutputStream wrapOutput(OutputStream output, boolean enableCompression) throws IOException {
        if (config.getMaxRequestSize() > 0) {
            output = new LimitingOutputStream(config.getMaxRequestSize(), output);
        }

        // when we are writing a zip file we don't bother with compression
        if (enableCompression && config.isCompression()) {
            output = new GZIPOutputStream(output);
        }

        if (config.isTraceMessage()) {
            output = config.teeOutputStream(output);
        }

        if (config.hasMessageHandlers()) {
            output = new MessageHandlerOutputStream(config, url, output);
        }

        return output;
    }

    private OutputStream connectRaw(String uri, HashMap<String, String> httpHeaders, boolean enableCompression)
            throws IOException {
        url = new URL(uri);

        connection = createConnection(config, url, httpHeaders, enableCompression);
        connection.setRequestMethod("POST");
        connection.setDoInput(true);
        connection.setDoOutput(true);
        if (config.useChunkedPost()) {
            connection.setChunkedStreamingMode(4096);
        }

        return connection.getOutputStream();
    }

    public static HttpURLConnection createConnection(ConnectorConfig config, URL url,
            HashMap<String, String> httpHeaders) throws IOException {
        return createConnection(config, url, httpHeaders, true);
    }

    public static HttpURLConnection createConnection(ConnectorConfig config, URL url,
            HashMap<String, String> httpHeaders, boolean enableCompression) throws IOException {

        if (config.isTraceMessage()) {
            config.getTraceStream().println( "WSC: Creating a new connection to " + url + " Proxy = " +
                    config.getProxy() + " username " + config.getProxyUsername());
        }

        HttpURLConnection connection = (HttpURLConnection) url.openConnection(config.getProxy());
        if (httpHeaders == null || (httpHeaders.get("User-Agent") == null && httpHeaders.get("user-agent") == null)) {
            connection.addRequestProperty("User-Agent", VersionInfo.info());
        }

        /*
         * Add all the client specific headers here
         */
        if (config.getHeaders() != null) {
            for (Entry<String, String> ent : config.getHeaders().entrySet()) {
                connection.setRequestProperty(ent.getKey(), ent.getValue());
            }
        }

        if (enableCompression && config.isCompression()) {
            connection.addRequestProperty("Content-Encoding", "gzip");
            connection.addRequestProperty("Accept-Encoding", "gzip");
        }

        if (config.getProxyUsername() != null) {
            String token = config.getProxyUsername() + ":" + config.getProxyPassword();
            String auth = "Basic " + new String(Base64.encode(token.getBytes()));
            connection.addRequestProperty("Proxy-Authorization", auth);
            connection.addRequestProperty("Https-Proxy-Authorization", auth);
        }

        if (httpHeaders != null) {
            for (Map.Entry<String, String> entry : httpHeaders.entrySet()) {
                connection.addRequestProperty(entry.getKey(), entry.getValue());
            }
        }

        if (config.getReadTimeout() != 0) {
            connection.setReadTimeout(config.getReadTimeout());
        }

        if (config.getConnectionTimeout() != 0) {
            connection.setConnectTimeout(config.getConnectionTimeout());
        }

        return connection;
    }

    @Override
    public InputStream getContent() throws IOException {
        InputStream in;

        try {
            in = connection.getInputStream();
        } catch (IOException e) {
            in = connection.getErrorStream();
            if (in == null) {
                throw e;
            }
        }

        successful = connection.getResponseCode() < 400;

        String encoding = connection.getHeaderField("Content-Encoding");

        if (config.getMaxResponseSize() > 0) {
            in = new LimitingInputStream(config.getMaxResponseSize(), in);
        }

        if ("gzip".equals(encoding)) {
            in = new GZIPInputStream(in);
        }

        if (config.hasMessageHandlers() || config.isTraceMessage()) {
            byte[] bytes = FileUtil.toBytes(in);
            in = new ByteArrayInputStream(bytes);

            if (config.hasMessageHandlers()) {
                Iterator<MessageHandler> it = config.getMessagerHandlers();
                while(it.hasNext()) {
                    MessageHandler handler = it.next();
                    if (handler instanceof MessageHandlerWithHeaders) {
                        ((MessageHandlerWithHeaders) handler).handleResponse(url, bytes, connection.getHeaderFields());
                    } else {
                        handler.handleResponse(url, bytes);
                    }
                }
            }

            if (config.isTraceMessage()) {
                Map<String, List<String>> headers = connection.getHeaderFields();
                for (Map.Entry header : headers.entrySet()) {
                    config.getTraceStream().print(header.getKey());
                    config.getTraceStream().print("=");
                    config.getTraceStream().println(header.getValue());
                }

                config.teeInputStream(bytes);
            }
        }

        return in;
    }

    @Override
    public boolean isSuccessful() {
        return successful;
    }

}


text:
/*                     __                                               *\
**     ________ ___   / /  ___      __ ____  Scala.js API               **
**    / __/ __// _ | / /  / _ | __ / // __/  (c) 2013, LAMP/EPFL        **
**  __\ \/ /__/ __ |/ /__/ __ |/_// /_\ \    http://scala-lang.org/     **
** /____/\___/_/ |_/____/_/ | |__/ /____/                               **
**                          |/____/                                     **
\*                                                                      */

package scala.scalajs.js.timers

import scala.scalajs.js
import js.annotation.JSGlobalScope

/**
 *  Non-Standard
 *  Raw JavaScript timer methods.
 *
 *  The methods on this object expose the raw JavaScript methods for timers. In
 *  general it is more advisable to use the methods directly defined on
 *  [[timers]] as they are more Scala-like.
 */
@js.native
@JSGlobalScope
object RawTimers extends js.Object {

  /** Schedule `handler` for execution in `interval` milliseconds.
   *
   *  @param handler the function to call after `interval` has passed
   *  @param interval duration in milliseconds to wait
   *  @return A handle that can be used to cancel the timeout by passing it
   *          to [[clearTimeout]].
   */
  def setTimeout(handler: js.Function0[Any], interval: Double): SetTimeoutHandle = js.native

  /** Cancel a timeout execution
   *  @param handle The handle returned by [[setTimeout]]
   */
  def clearTimeout(handle: SetTimeoutHandle): Unit = js.native

  /** Schedule `handler` for repeated execution every `interval`
   *  milliseconds.
   *
   *  @param handler the function to call after each `interval`
   *  @param interval duration in milliseconds between executions
   *  @return A handle that can be used to cancel the interval by passing it
   *          to [[clearInterval]].
   */
  def setInterval(handler: js.Function0[Any], interval: Double): SetIntervalHandle = js.native

  /** Cancel an interval execution
   *  @param handle The handle returned by [[setInterval]]
   */
  def clearInterval(handle: SetIntervalHandle): Unit = js.native

}


text:
package com.microsoft.bingads.v12.campaignmanagement;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="ListItems" type="{https://bingads.microsoft.com/CampaignManagement/v12}ArrayOfSharedListItem" minOccurs="0"/>
 *         <element name="SharedList" type="{https://bingads.microsoft.com/CampaignManagement/v12}SharedList" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "listItems",
    "sharedList"
})
@XmlRootElement(name = "AddListItemsToSharedListRequest")
public class AddListItemsToSharedListRequest {

    @XmlElement(name = "ListItems", nillable = true)
    protected ArrayOfSharedListItem listItems;
    @XmlElement(name = "SharedList", nillable = true)
    protected SharedList sharedList;

    /**
     * Gets the value of the listItems property.
     *
     * @return
     *     possible object is
     *     {@link ArrayOfSharedListItem }
     *
     */
    public ArrayOfSharedListItem getListItems() {
        return listItems;
    }

    /**
     * Sets the value of the listItems property.
     *
     * @param value
     *     allowed object is
     *     {@link ArrayOfSharedListItem }
     *
     */
    public void setListItems(ArrayOfSharedListItem value) {
        this.listItems = value;
    }

    /**
     * Gets the value of the sharedList property.
     *
     * @return
     *     possible object is
     *     {@link SharedList }
     *
     */
    public SharedList getSharedList() {
        return sharedList;
    }

    /**
     * Sets the value of the sharedList property.
     *
     * @param value
     *     allowed object is
     *     {@link SharedList }
     *
     */
    public void setSharedList(SharedList value) {
        this.sharedList = value;
    }

}


text:
BSLS_IDENT("$Id: $")

//@PURPOSE: Provide an allocator to manage pools of varying object sizes.
//
//@CLASSES:
//   bdlma::ConcurrentMultipoolAllocator: allocator managing varying size pools
//
//@SEE_ALSO: bdlma_concurrentpool, bdlma_concurrentmultipool
//
//@DESCRIPTION: This component provides an allocator,
// 'bdlma::ConcurrentMultipoolAllocator', that implements the
// 'bdlma::ManagedAllocator' protocol and provides an allocator that maintains
// a configurable number of 'bdlma::ConcurrentPool' objects, each dispensing
// memory blocks of a unique size.  The 'bdlma::ConcurrentPool' objects are
// placed in an array, starting at index 0, with each successive pool managing
// memory blocks of a size twice that of the previous pool.  Each multipool
// allocation (deallocation) request allocates memory from (returns memory to)
// the internal pool managing memory blocks of the smallest size not less than
// the requested size, or else from a separately managed list of memory blocks,
// if no internal pool managing memory block of sufficient size exists.  Both
// the 'release' method and the destructor of a
// 'bdlma::ConcurrentMultipoolAllocator' release all memory currently allocated
// via the object.
//..
//   ,------------------------.
//  ( bcema::MultiPoolAllocator )
//   `------------------------'
//               |         ctor/dtor
//               |         maxPooledBlockSize
//               |         numPools
//               |         reserveCapacity
//               V
//    ,----------------------.
//   ( bdlma::ManagedAllocator )
//    `----------------------'
//               |         release
//               V
//       ,-----------------.
//      (  bslma::Allocator )
//       `-----------------'
//                        allocate
//                        deallocate
//..
// The main difference between a 'bdlma::ConcurrentMultipoolAllocator' and a
// 'bdlma::ConcurrentMultipool' is that, very often, a
// 'bdlma::ConcurrentMultipoolAllocator' is managed through a
// 'bslma::Allocator' pointer.  Hence, every call to the 'allocate' method
// invokes a virtual function call, which is slower than invoking the
// non-virtual 'allocate' method on a 'bdlma::ConcurrentMultipool'.  However,
// since 'bslma::Allocator *' is widely used across BDE interfaces,
// 'bdlma::ConcurrentMultipoolAllocator' is more general purposed than a
// 'bdlma::ConcurrentMultipool'.
//
///Configuration at Construction
///-----------------------------
// When creating a 'bdlma::ConcurrentMultipoolAllocator', clients can
// optionally configure:
//
//: 1 NUMBER OF POOLS -- the number of internal pools (the block size managed
//:   by the first pool is eight bytes, with each successive pool managing
//:   block of a size twice that of the previous pool).
//: 2 GROWTH STRATEGY -- geometrically growing chunk size starting from 1 (in
//:   terms of the number of memory blocks per chunk), or fixed chunk size,
//:   specified as either:
//:   o the unique growth strategy for all pools, or
//:   o (if the number of pools is specified) an array of growth strategies
//:     corresponding to each individual pool
//:   If the growth strategy is not specified, geometric growth is used for all
//:   pools.
//: 3 MAX BLOCKS PER CHUNK -- the maximum number of memory blocks within a
//:   chunk, specified as either:
//:     o the unique maximum-blocks-per-chunk value for all of the pools, or
//:     o an array of maximum-blocks-per-chunk values corresponding to each
//:       individual pool.
//:   If the maximum blocks per chunk is not specified, an
//:   implementation-defined default value is used.  Note that the maximum
//:   blocks per chunk can be configured only if the number of pools is also
//:   configured.
//: 4 BASIC ALLOCATOR -- the allocator used to supply memory (to replenish an
//:   internal pool, or directly if the maximum block size is exceeded).  If
//:   not specified, the currently installed default allocator (see
//:   'bslma_default') is used.
//
// A default-constructed multipool allocator has a relatively small,
// implementation-defined number of pools 'N' with respective block sizes
// ranging from '2^3 = 8' to '2^(N+2)'.  By default, the initial chunk size,
// (i.e., the number of blocks of a given size allocated at once to replenish a
// pool's memory) is 1, and each pool's chunk size grows geometrically until it
// reaches an implementation-defined maximum, at which it is capped.  Finally,
// unless otherwise specified, all memory comes from the allocator that was the
// currently installed default allocator at the time the
// 'bdlma::ConcurrentMultipoolAllocator' was created.
//
// Using the various pooling options described above, we can configure the
// number of pools maintained, whether replenishment should be adaptive (i.e.,
// geometric starting with 1) or fixed at a maximum chunk size, what that
// maximum chunk size should be (which need not be an integral power of 2), and
// the underlying allocator used to supply memory.  Note that both GROWTH
// STRATEGY and MAX BLOCKS PER CHUNK can be specified separately either as a
// single value applying to all of the maintained pools, or as an array of
// values, with the elements applying to each individually maintained pool.
//
///Usage
///-----
// This section illustrates intended use of this component.
//
///Example 1: Using a 'bdlma::ConcurrentMultipoolAllocator'
/// - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// A 'bdlma::ConcurrentMultipoolAllocator' can be used to supply memory to
// node-based data structures such as 'bsl::set', 'bsl::list' or 'bsl::map'.
// Suppose we are implementing a container of named graphs data structure,
// where a graph is defined by a set of edges and nodes.  The various
// fixed-sized nodes can be efficiently allocated by a
// 'bdlma::ConcurrentMultipoolAllocator'.
//
// First, the edge class, 'my_Edge', is defined as follows:
//..
//  class my_Node;
//
//  class my_Edge {
//      // This class represents an edge within a graph.  Both ends of the
//      // edge must be connected to nodes.
//
//      // DATA
//      my_Node *d_first;   // first node
//      my_Node *d_second;  // second node
//
//      // ...
//
//    public:
//      // CREATORS
//      my_Edge(my_Node *first, my_Node *second);
//          // Create an edge that connects to the specified 'first' and
//          // 'second' nodes.
//
//      // ...
//  };
//
//  // CREATORS
//  my_Edge::my_Edge(my_Node *first, my_Node *second)
//  : d_first(first), d_second(second)
//  {
//  }
//..
// Then, the node class, 'my_Node', is defined as follows:
//..
//  class my_Node {
//      // This class represents a node within a graph.  A node can be
//      // connected to any number of edges.
//
//      // DATA
//      bsl::set<my_Edge *> d_edges;  // set of edges this node connects to
//
//      // ...
//
//    private:
//      // Not implemented:
//      my_Node(const my_Node&);
//
//    public:
//      // TRAITS
//      BSLMF_NESTED_TRAIT_DECLARATION(my_Node, bslma::UsesBslmaAllocator);
//
//      // CREATORS
//      explicit my_Node(bslma::Allocator *basicAllocator = 0);
//          // Create a node not connected to any other nodes.  Optionally
//          // specify a 'basicAllocator' used to supply memory.  If
//          // 'basicAllocator' is 0, the currently installed default allocator
//          // is used.
//
//      // ...
//  };
//
//  // CREATORS
//  my_Node::my_Node(bslma::Allocator *basicAllocator)
//  : d_edges(basicAllocator)
//  {
//  }
//..
// Then we define the graph class, 'my_Graph', as follows:
//..
//  class my_Graph {
//      // This class represents a graph having sets of nodes and edges.
//
//      // DATA
//      bsl::set<my_Edge> d_edges;  // set of edges in this graph
//      bsl::set<my_Node> d_nodes;  // set of nodes in this graph
//
//      // ...
//
//    private:
//      // Not implemented:
//      my_Graph(const my_Graph&);
//
//    public:
//      // TRAITS
//      BSLMF_NESTED_TRAIT_DECLARATION(my_Graph, bslma::UsesBslmaAllocator);
//
//      // CREATORS
//      explicit my_Graph(bslma::Allocator *basicAllocator = 0);
//          // Create an empty graph.  Optionally specify a 'basicAllocator'
//          // used to supply memory.  If 'basicAllocator' is 0, the currently
//          // installed default allocator is used.
//
//      // ...
//  };
//
//  my_Graph::my_Graph(bslma::Allocator *basicAllocator)
//  : d_edges(basicAllocator)
//  , d_nodes(basicAllocator)
//  {
//  }
//..
// Then finally, the container for the collection of named graphs,
// 'my_NamedGraphContainer', is defined as follows:
//..
//  class my_NamedGraphContainer {
//      // This class stores a map that index graph names to graph objects.
//
//      // DATA
//      bsl::map<bsl::string, my_Graph> d_graphMap;  // map from graph names to
//                                                   // graph
//
//    private:
//      // Not implemented:
//      my_NamedGraphContainer(const my_NamedGraphContainer&);
//
//    public:
//      // TRAITS
//      BSLMF_NESTED_TRAIT_DECLARATION(my_NamedGraphContainer,
//                                     bslma::UsesBslmaAllocator);
//
//      // CREATORS
//      explicit my_NamedGraphContainer(bslma::Allocator *basicAllocator = 0);
//          // Create an empty named graph container.  Optionally specify a
//          // 'basicAllocator' used to supply memory.  If 'basicAllocator' is
//          // 0, the currently installed default allocator is used.
//
//      // ...
//  };
//
//  // CREATORS
//  my_NamedGraphContainer::my_NamedGraphContainer(
//                                            bslma::Allocator *basicAllocator)
//  : d_graphMap(basicAllocator)
//  {
//  }
//..
// Finally, in 'main', we can create a 'bdlma::ConcurrentMultipoolAllocator'
// and pass it to our 'my_NamedGraphContainer'.  Since we know that the maximum
// block size needed is 32 (comes from 'sizeof(my_Graph)'), we can calculate
// the number of pools needed by using the formula specified in the
// "configuration at construction" section:
//..
//  largestPoolSize < 2 ^ (N + 2).
//..
// When solved for the above equation, the smallest 'N' that satisfies this
// relationship is 3:
//..
//  enum { k_NUM_POOLS = 3 };
//
//  bdlma::ConcurrentMultipoolAllocator basicAllocator(k_NUM_POOLS);
//
//  my_NamedGraphContainer container(&basicAllocator);
//..

#ifndef INCLUDED_BDLSCM_VERSION
#include <bdlscm_version.h>
#endif

#ifndef INCLUDED_BDLMA_CONCURRENTMULTIPOOL
#include <bdlma_concurrentmultipool.h>
#endif

#ifndef INCLUDED_BDLMA_MANAGEDALLOCATOR
#include <bdlma_managedallocator.h>
#endif

#ifndef INCLUDED_BSLMA_ALLOCATOR
#include <bslma_allocator.h>
#endif

#ifndef INCLUDED_BSLS_TYPES
#include <bsls_types.h>
#endif

namespace BloombergLP {
namespace bdlma {

                    // ==================================
                    // class ConcurrentMultipoolAllocator
                    // ==================================

class ConcurrentMultipoolAllocator : public bdlma::ManagedAllocator {
    // This class implements the 'bdlma::ManagedAllocator' protocol to provide
    // a thread-safe allocator that maintains a configurable number of 'Pool'
    // objects, each dispensing memory blocks of a unique size.  The 'Pool'
    // objects are placed in an array, with each successive pool managing
    // memory blocks of size twice that of the previous pool.  Each multipool
    // allocation (deallocation) request allocates memory from (returns memory
    // to) the internal pool having the smallest block size not less than the
    // requested size, or, if no pool manages memory blocks of sufficient
    // sized, from a separately managed list of memory blocks.  Both the
    // 'release' method and the destructor of a 'ConcurrentMultipoolAllocator'
    // release all memory currently allocated via the object.

    // DATA
    ConcurrentMultipool d_multipool;  // owned allocator

  private:
    // NOT IMPLEMENTED
    ConcurrentMultipoolAllocator(const ConcurrentMultipoolAllocator&);
    ConcurrentMultipoolAllocator& operator=
                                         (const ConcurrentMultipoolAllocator&);

  public:
    // CREATORS
    explicit ConcurrentMultipoolAllocator(
                                         bslma::Allocator *basicAllocator = 0);
    explicit ConcurrentMultipoolAllocator(
                                         int               numPools,
                                         bslma::Allocator *basicAllocator = 0);
    explicit ConcurrentMultipoolAllocator(
                              bsls::BlockGrowth::Strategy  growthStrategy,
                              bslma::Allocator            *basicAllocator = 0);
    ConcurrentMultipoolAllocator(
                              int                          numPools,
                              bsls::BlockGrowth::Strategy  growthStrategy,
                              bslma::Allocator            *basicAllocator = 0);
    ConcurrentMultipoolAllocator(
                              int                          numPools,
                              bsls::BlockGrowth::Strategy  growthStrategy,
                              int                          maxBlocksPerChunk,
                              bslma::Allocator            *basicAllocator = 0);
        // Create a multipool allocator.  Optionally specify 'numPools',
        // indicating the number of internally created 'Pool' objects; the
        // block size of the first pool is 8 bytes, with the block size of each
        // additional pool successively doubling.  If 'numPools' is not
        // specified, an implementation-defined number of pools 'N' -- covering
        // memory blocks ranging in size from '2^3 = 8' to '2^(N+2)' -- are
        // created.  Optionally specify a 'growthStrategy' indicating whether
        // the number of blocks allocated at once for every internally created
        // 'Pool' should be either fixed or grow geometrically, starting with
        // 1.  If 'growthStrategy' is not specified, the allocation strategy
        // for each internally created 'Pool' object is geometric, starting
        // from 1.  If 'numPools' is specified, optionally specify a
        // 'maxBlocksPerChunk', indicating the maximum number of blocks to be
        // allocated at once when a pool must be replenished.  If
        // 'maxBlocksPerChunk' is not specified, an implementation-defined
        // value is used.  Optionally specify a 'basicAllocator' used to supply
        // memory.  If 'basicAllocator' is 0, the currently installed default
        // allocator is used.  Memory allocation (and deallocation) requests
        // will be satisfied using the internally maintained pool managing
        // memory blocks of the smallest size not less than the requested size,
        // or directly from the underlying allocator (supplied at
        // construction), if no internally pool managing memory block of
        // sufficient size exists.  The behavior is undefined unless
        // '1 <= numPools' and '1 <= maxBlocksPerChunk'.  Note that, on
        // platforms where '8 < bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT',
        // excess memory may be allocated for pools managing smaller blocks.
        // Also note that 'maxBlocksPerChunk' need not be an integral power of
        // 2; if geometric growth would exceed the maximum value, the chunk
        // size is capped at that value).

    ConcurrentMultipoolAllocator(
                        int                                numPools,
                        const bsls::BlockGrowth::Strategy *growthStrategyArray,
                        bslma::Allocator                  *basicAllocator = 0);
    ConcurrentMultipoolAllocator(
                        int                                numPools,
                        const bsls::BlockGrowth::Strategy *growthStrategyArray,
                        int                                maxBlocksPerChunk,
                        bslma::Allocator                  *basicAllocator = 0);
    ConcurrentMultipoolAllocator(
                           int                          numPools,
                           bsls::BlockGrowth::Strategy  growthStrategy,
                           const int                   *maxBlocksPerChunkArray,
                           bslma::Allocator            *basicAllocator = 0);
    ConcurrentMultipoolAllocator(
                     int                                numPools,
                     const bsls::BlockGrowth::Strategy *growthStrategyArray,
                     const int                         *maxBlocksPerChunkArray,
                     bslma::Allocator                  *basicAllocator = 0);
        // Create a multipool allocator having the specified 'numPools',
        // indicating the number of internally created 'Pool' objects; the
        // block size of the first pool is 8 bytes, with the block size of each
        // additional pool successively doubling.  Optionally specify a
        // 'growthStrategy' indicating whether the number of blocks allocated
        // at once for every internally created 'Pool' should be either fixed
        // or grow geometrically, starting with 1.  If 'growthStrategy' is not
        // specified, optionally specify 'growthStrategyArray', indicating the
        // strategies for each individual 'Pool' created by this object.  If
        // neither 'growthStrategy' nor 'growthStrategyArray' are specified,
        // the allocation strategy for each internally created 'Pool' object
        // will grow geometrically, starting from 1.  Optionally specify a
        // 'maxBlocksPerChunk', indicating the maximum number of blocks to be
        // allocated at once when a pool must be replenished.  If
        // 'maxBlocksPerChunk' is not specified, optionally specify
        // 'maxBlocksPerChunkArray', indicating the maximum number of blocks to
        // allocate at once for each individually created 'Pool' object.  If
        // neither 'maxBlocksPerChunk' nor 'maxBlocksPerChunkArray' are
        // specified, an implementation-defined value is used.  Optionally
        // specify a 'basicAllocator' used to supply memory.  If
        // 'basicAllocator' is 0, the currently installed default allocator is
        // used.  Memory allocation (and deallocation) requests will be
        // satisfied using the internally maintained pool managing memory
        // blocks of the smallest size not less than the requested size, or
        // directly from the underlying allocator (supplied at construction),
        // if no internally pool managing memory block of sufficient size
        // exists.  The behavior is undefined unless '1 <= numPools',
        // 'growthStrategyArray' has at least 'numPools' strategies,
        // '1 <= maxBlocksPerChunk' and 'maxBlocksPerChunkArray' have at least
        // 'numPools' positive values.  Note that, on platforms where
        // '8 < bsls::AlignmentUtil::BSLS_MAX_ALIGNMENT', excess memory may be
        // allocated for pools managing smaller blocks.  Also note that the
        // maximum need not be an integral power of 2; if geometric growth
        // would exceed a maximum value, the chunk size is capped at that
        // value).

    virtual ~ConcurrentMultipoolAllocator();
        // Destroy this multipool allocator.  All memory allocated from this
        // allocator is released.

    // MANIPULATORS
    void reserveCapacity(bsls::Types::size_type size, int numObjects);
        // Reserve memory from this multipool allocator to satisfy memory
        // requests for at least the specified 'numObjects' having the
        // specified 'size' (in bytes) before the pool replenishes.  If 'size'
        // is 0, this method has no effect.  The behavior is undefined unless
        // 'size <= maxPooledBlockSize()' and '0 <= numObjects'.

                                // Virtual Functions

    virtual void *allocate(bsls::Types::size_type size);
        // Return the address of a contiguous block of maximally aligned memory
        // of (at least) the specified 'size' (in bytes).  If 'size' is 0, no
        // memory is allocated and 0 is returned.  If
        // 'size > maxPooledBlockSize()', the memory allocation is managed
        // directly by the underlying allocator, but will not be pooled .  The
        // behavior is undefined unless '0 <= size'.

    virtual void deallocate(void *address);
        // Relinquish the memory block at the specified 'address' back to this
        // allocator for reuse.  If 'address' is 0, this method has no effect.
        // The behavior is undefined unless 'address' was allocated by this
        // allocator, and has not already been deallocated.

    virtual void release();
        // Relinquish all memory currently allocated through this multipool
        // allocator.

    // ACCESSORS
    int numPools() const;
        // Return the number of pools managed by this multipool allocator.

    bsls::Types::size_type maxPooledBlockSize() const;
        // Return the maximum size of memory blocks that are pooled by this
        // multipool object.  Note that the maximum value is defined as:
        //..
        //  2 ^ (numPools + 2)
        //..
        // where 'numPools' is either specified at construction, or an
        // implementation-defined value.
};

// ============================================================================
//                             INLINE DEFINITIONS
// ============================================================================

                    // ----------------------------------
                    // class ConcurrentMultipoolAllocator
                    // ----------------------------------

// CREATORS
inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  bslma::Allocator                 *basicAllocator)
: d_multipool(basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                               numPools,
                  bslma::Allocator                 *basicAllocator)
: d_multipool(numPools, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  bsls::BlockGrowth::Strategy       growthStrategy,
                  bslma::Allocator                 *basicAllocator)
: d_multipool(growthStrategy, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                               numPools,
                  bsls::BlockGrowth::Strategy       growthStrategy,
                  bslma::Allocator                 *basicAllocator)
: d_multipool(numPools, growthStrategy, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                                numPools,
                  const bsls::BlockGrowth::Strategy *growthStrategyArray,
                  bslma::Allocator                  *basicAllocator)
: d_multipool(numPools, growthStrategyArray, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                               numPools,
                  bsls::BlockGrowth::Strategy       growthStrategy,
                  int                               maxBlocksPerChunk,
                  bslma::Allocator                 *basicAllocator)
: d_multipool(numPools, growthStrategy, maxBlocksPerChunk, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                                numPools,
                  const bsls::BlockGrowth::Strategy *growthStrategyArray,
                  int                                maxBlocksPerChunk,
                  bslma::Allocator                  *basicAllocator)
: d_multipool(numPools, growthStrategyArray, maxBlocksPerChunk, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                                numPools,
                  bsls::BlockGrowth::Strategy        growthStrategy,
                  const int                         *maxBlocksPerChunkArray,
                  bslma::Allocator                  *basicAllocator)
: d_multipool(numPools, growthStrategy, maxBlocksPerChunkArray, basicAllocator)
{
}

inline
ConcurrentMultipoolAllocator::ConcurrentMultipoolAllocator(
                  int                                numPools,
                  const bsls::BlockGrowth::Strategy *growthStrategyArray,
                  const int                         *maxBlocksPerChunkArray,
                  bslma::Allocator                  *basicAllocator)
: d_multipool(numPools,
              growthStrategyArray,
              maxBlocksPerChunkArray,
              basicAllocator)
{
}

// MANIPULATORS
inline
void ConcurrentMultipoolAllocator::reserveCapacity(
                                             bsls::Types::size_type size,
                                             int                    numObjects)
{
    d_multipool.reserveCapacity(size, numObjects);
}

// ACCESSORS
inline
int ConcurrentMultipoolAllocator::numPools() const
{
    return d_multipool.numPools();
}

inline
bsls::Types::size_type ConcurrentMultipoolAllocator::maxPooledBlockSize() const
{
    return d_multipool.maxPooledBlockSize();
}

}  // close package namespace
}  // close enterprise namespace

#endif

// ----------------------------------------------------------------------------
// Copyright 2016 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------


text:
import styled from "styled-components/macro";
import * as s from "../../../styles";

export const Wrapper = styled.div({
  position: "relative",
  width: "100%",
  height: "100%",
});

type ImageProps = {
  visible?: boolean;
  noAnimation?: boolean;
  backgroundImage?: string | null;
};

export const Image = styled.div.attrs((props: ImageProps) => ({
  style: {
    backgroundImage: props.backgroundImage ? `url("${props.backgroundImage}")` : "none",
  },
}))(
  (props: ImageProps) =>
    ({
      position: "absolute",
      left: 0,
      top: 0,
      width: "100%",
      height: "100%",
      backgroundSize: "cover",
      backgroundRepeat: "no-repeat",
      backgroundPosition: "center",
      transition: props.noAnimation ? "initial" : s.animation.backgroundImage,
      opacity: props.visible ? 1 : 0,
    } as const),
);


text:
/**
 * Created by lunachi on 2017/7/12.
 */

import React from 'react';

require('./main.css');

export default class CInput extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      text: "item 组件",
    };
  }

  componentDidMount() {

  }

  componentWillUnmount() {

  }

  handleClick() {

  }

  render() {
    return (
      <h1>{this.state.text}</h1>
    );
  }
}


text:
<?php

namespace Magento\Bundle\Model\Product;

/**
 * @magentoDataFixture Magento/Bundle/_files/product_with_tier_pricing.php
 */
class PriceTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @var \Magento\Bundle\Model\Product\Price
     */
    protected $_model;

    protected function setUp()
    {
        $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
            'Magento\Bundle\Model\Product\Price'
        );
    }

    public function testGetTierPrice()
    {
        $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
            'Magento\Catalog\Model\Product'
        );
        $product->load(3);
        // fixture

        // Note that this is really not the "tier price" but the "tier discount percentage"
        // so it is expected to be increasing instead of decreasing
        $this->assertEquals(8.0, $this->_model->getTierPrice(2, $product));
        $this->assertEquals(20.0, $this->_model->getTierPrice(3, $product));
        $this->assertEquals(20.0, $this->_model->getTierPrice(4, $product));
        $this->assertEquals(30.0, $this->_model->getTierPrice(5, $product));
    }
}


text:
#include "nacl_mounts/kernel_wrap.h"
#include <alloca.h>
#include <dirent.h>
#include <errno.h>
#include <irt.h>
#include <irt_syscalls.h>
#include <nacl_stat.h>
#include <string.h>
#include <sys/stat.h>
#include "nacl_mounts/kernel_intercept.h"

namespace {

void stat_to_nacl_stat(const struct stat* buf, nacl_abi_stat* nacl_buf) {
  memset(nacl_buf, 0, sizeof(struct nacl_abi_stat));
  nacl_buf->nacl_abi_st_dev = buf->st_dev;
  nacl_buf->nacl_abi_st_ino = buf->st_ino;
  nacl_buf->nacl_abi_st_mode = buf->st_mode;
  nacl_buf->nacl_abi_st_nlink = buf->st_nlink;
  nacl_buf->nacl_abi_st_uid = buf->st_uid;
  nacl_buf->nacl_abi_st_gid = buf->st_gid;
  nacl_buf->nacl_abi_st_rdev = buf->st_rdev;
  nacl_buf->nacl_abi_st_size = buf->st_size;
  nacl_buf->nacl_abi_st_blksize = buf->st_blksize;
  nacl_buf->nacl_abi_st_blocks = buf->st_blocks;
  nacl_buf->nacl_abi_st_atime = buf->st_atime;
  nacl_buf->nacl_abi_st_mtime = buf->st_mtime;
  nacl_buf->nacl_abi_st_ctime = buf->st_ctime;
}

}  // namespace

// From native_client/src/trusted/service_runtime/include/sys/dirent.h

#ifndef nacl_abi___ino_t_defined
#define nacl_abi___ino_t_defined
typedef int64_t nacl_abi___ino_t;
typedef nacl_abi___ino_t nacl_abi_ino_t;
#endif

#ifndef nacl_abi___off_t_defined
#define nacl_abi___off_t_defined
typedef int64_t nacl_abi__off_t;
typedef nacl_abi__off_t nacl_abi_off_t;
#endif

/* We need a way to define the maximum size of a name. */
#ifndef MAXNAMLEN
# ifdef NAME_MAX
#  define MAXNAMLEN NAME_MAX
# else
#  define MAXNAMLEN 255
# endif
#endif

struct nacl_abi_dirent {
  nacl_abi_ino_t nacl_abi_d_ino;
  nacl_abi_off_t nacl_abi_d_off;
  uint16_t       nacl_abi_d_reclen;
  char           nacl_abi_d_name[MAXNAMLEN + 1];
};

static const int d_name_shift = offsetof (dirent, d_name) -
  offsetof (struct nacl_abi_dirent, nacl_abi_d_name);

EXTERN_C_BEGIN

#define REAL(name) __nacl_irt_##name##_real
#define WRAP(name) __nacl_irt_##name##_wrap
#define MUX(name) __nacl_irt_##name
#define DECLARE(name) typeof(MUX(name)) REAL(name);
#define DO_WRAP(name) do { \
    REAL(name) = MUX(name); \
    MUX(name) = (typeof(REAL(name))) WRAP(name); \
  } while (0)

DECLARE(chdir)
DECLARE(close)
DECLARE(dup)
DECLARE(fstat)
DECLARE(getcwd)
DECLARE(getdents)
DECLARE(mkdir)
DECLARE(open)
DECLARE(read)
DECLARE(rmdir)
DECLARE(seek)
DECLARE(stat)
DECLARE(write)

int access(const char* path, int amode) NOTHROW {
  return ki_access(path, amode);
}

int chdir(const char* path) NOTHROW {
  return ki_chdir(path);
}

int chmod(const char* path, mode_t mode) NOTHROW {
  return ki_chmod(path, mode);
}

int WRAP(chdir) (const char* pathname) {
  return (ki_chdir(pathname)) ? errno : 0;
}

int WRAP(close)(int fd) {
  return (ki_close(fd) < 0) ? errno : 0;
}

int WRAP(dup)(int fd, int* newfd) NOTHROW {
  *newfd = ki_dup(fd);
  return (*newfd < 0) ? errno : 0;
}

int WRAP(fstat)(int fd, struct nacl_abi_stat *nacl_buf) {
  struct stat buf;
  memset(&buf, 0, sizeof(struct stat));
  int res = ki_fstat(fd, &buf);
  if (res < 0)
    return errno;
  stat_to_nacl_stat(&buf, nacl_buf);
  return 0;
}

int fsync(int fd) {
  return ki_fsync(fd);
}

char* getcwd(char* buf, size_t size) NOTHROW {
  // gtest uses getcwd in a static initializer. If we haven't initialized the
  // kernel-intercept yet, just return ".".
  if (!ki_is_initialized()) {
    if (size < 2) {
      errno = ERANGE;
      return NULL;
    }
    buf[0] = '.';
    buf[1] = 0;
    return buf;
  }
  return ki_getcwd(buf, size);
}

char* WRAP(getcwd)(char* buf, size_t size) {
  return ki_getcwd(buf, size);
}

char* getwd(char* buf) NOTHROW {
  return ki_getwd(buf);
}

int getdents(int fd, void* buf, unsigned int count) NOTHROW {
  return ki_getdents(fd, buf, count);
}

int WRAP(getdents)(int fd, dirent* nacl_buf, size_t nacl_count, size_t *nread) {
  int nacl_offset = 0;
  // "buf" contains dirent(s); "nacl_buf" contains nacl_abi_dirent(s).
  // nacl_abi_dirent(s) are smaller than dirent(s), so nacl_count bytes buffer
  // is enough
  char* buf = (char*)alloca(nacl_count);
  int offset = 0;
  int count;

  count = ki_getdents(fd, buf, nacl_count);
  if (count < 0)
    return errno;

  while (offset < count) {
    dirent* d = (dirent*)(buf + offset);
    nacl_abi_dirent* nacl_d = (nacl_abi_dirent*)((char*)nacl_buf + nacl_offset);
    nacl_d->nacl_abi_d_ino = d->d_ino;
    nacl_d->nacl_abi_d_off = d->d_off;
    nacl_d->nacl_abi_d_reclen = d->d_reclen - d_name_shift;
    size_t d_name_len = d->d_reclen - offsetof(dirent, d_name);
    memcpy(nacl_d->nacl_abi_d_name, d->d_name, d_name_len);

    offset += d->d_reclen;
    nacl_offset += nacl_d->nacl_abi_d_reclen;
  }

  *nread = nacl_offset;
  return 0;
}

int isatty(int fd) NOTHROW {
  return ki_isatty(fd);
}

int mkdir(const char* path, mode_t mode) NOTHROW {
  return ki_mkdir(path, mode);
}

int WRAP(mkdir) (const char* pathname, mode_t mode) {
  return (ki_mkdir(pathname, mode)) ? errno : 0;
}

int mount(const char* source, const char* target, const char* filesystemtype,
          unsigned long mountflags, const void* data) NOTHROW {
  return ki_mount(source, target, filesystemtype, mountflags, data);
}

int WRAP(open)(const char* pathname, int oflag, mode_t cmode, int* newfd) {
  *newfd = ki_open(pathname, oflag);
  return (*newfd < 0) ? errno : 0;
}

int WRAP(read)(int fd, void *buf, size_t count, size_t *nread) {
  *nread = ki_read(fd, buf, count);
  return (*nread < 0) ? errno : 0;
}

int remove(const char* path) NOTHROW {
  return ki_remove(path);
}

int rmdir(const char* path) NOTHROW {
  return ki_rmdir(path);
}

int WRAP(rmdir)(const char* pathname) {
  return (ki_rmdir(pathname) < 0) ? errno : 0;
}

int WRAP(seek)(int fd, off_t offset, int whence, off_t* new_offset) {
  *new_offset = ki_lseek(fd, offset, whence);
  return (*new_offset < 0) ? errno : 0;
}

int WRAP(stat)(const char *pathname, struct nacl_abi_stat *nacl_buf) {
  struct stat buf;
  memset(&buf, 0, sizeof(struct stat));
  int res = ki_stat(pathname, &buf);
  if (res < 0)
    return errno;
  stat_to_nacl_stat(&buf, nacl_buf);
  return 0;
}

int umount(const char* path) NOTHROW {
  return ki_umount(path);
}

int unlink(const char* path) NOTHROW {
  return ki_unlink(path);
}

int WRAP(write)(int fd, const void *buf, size_t count, size_t *nwrote) {
  *nwrote = ki_write(fd, buf, count);
  return (*nwrote < 0) ? errno : 0;
}

EXTERN_C_END

static struct NaClMountsStaticInitializer {
  NaClMountsStaticInitializer() {
    DO_WRAP(chdir);
    DO_WRAP(close);
    DO_WRAP(dup);
    DO_WRAP(fstat);
    DO_WRAP(getcwd);
    DO_WRAP(getdents);
    DO_WRAP(mkdir);
    DO_WRAP(open);
    DO_WRAP(read);
    DO_WRAP(rmdir);
    DO_WRAP(seek);
    DO_WRAP(stat);
    DO_WRAP(write);
  }
} nacl_mounts_static_initializer;


text:
package org.cs3.pdt.common.structureElements;

import java.util.List;

import org.eclipse.core.resources.IFile;

public class PrologMatch extends AbstractPrologMatch {

	private String module;

	private String visibility;
	private String declOrDef;
	private String name;
	private int arity;

	public PrologMatch(SearchMatchElement searchMatchElement, String visibility, String module, String name, int arity, List<String> properties, IFile file, int line, String declOrDef, String signature) {
		super(searchMatchElement, properties, file, line, signature);
		this.declOrDef = declOrDef;
		this.visibility = visibility;
		this.module = module;
		this.name = name;
		this.arity = arity;
	}

	public PrologMatch(SearchMatchElement searchMatchElement, String visibility, String module, String name, int arity, List<String> properties, IFile file, int offset, int length, String declOrDef, String signature) {
		super(searchMatchElement, properties, file, offset, length, signature);
		this.declOrDef = declOrDef;
		this.visibility = visibility;
		this.module = module;
		this.name = name;
		this.arity = arity;
	}

	public String getModule() {
		return module;
	}

	public String getName() {
		return name;
	}

	public int getArity() {
		return arity;
	}

	public String getDeclOrDef() {
		return declOrDef;
	}

	public String getVisibility() {
		return visibility;
	}

}


text:
<?php

namespace PhpProbe\Probe;

use PhpProbe\Adapter\NullAdapter;
use PhpProbe\Adapter\Response\AdapterResponseInterface;
use PhpProbe\Adapter\Response\TestAdapterResponse;
use PhpProbe\Adapter\TestAdapter;
use PhpProbe\Check\TestCheck;
use ReflectionProperty;

/**
 * Class AbstractProbeTest
 *
 * @author  Michael BOUVY <michael.bouvy@gmail.com>
 * @package PhpProbe\Probe
 */
class AbstractProbeTest extends \PHPUnit_Framework_TestCase
{
    /**
     * Get a mocked AbstractProbe
     *
     * @param array $options
     * @param array $expectedOptions
     * @param bool  $construct
     *
     * @return ProbeInterface
     */
    protected function getProbeWithOptionsAndExpectedOptions(
        $options = array(),
        $expectedOptions = array(),
        $construct = true
    ) {
        $probe = $this->getMockBuilder('PhpProbe\Probe\AbstractProbe')
            ->setMethods(array('getExpectedOptions'))
            ->disableOriginalConstructor()
            ->getMock();

        $probe->expects($this->any())
            ->method('getExpectedOptions')
            ->will($this->returnValue($expectedOptions));

        /** @var ProbeInterface $probe */
        if ($construct) {
            $probe->__construct('test', $options, new NullAdapter());
        }
        return $probe;
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::__construct
     */
    public function testConstruct()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), array());
        $this->assertInstanceOf('PhpProbe\Probe\AbstractProbe', $probe);
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::configure
     */
    public function testConfigure()
    {
        $expectedOption = array(
            'testRequiredParam' => array(
                'name' => 'testRequiredParam', 'required' => true, 'type' => 'string', 'default' => 'default1')
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);

        $options = array(
            'testOptionalParam' => 'value2'
        );

        $optionsBefore = $this->readAttribute($probe, 'options');
        $this->assertArrayNotHasKey('testOptionalParam', $optionsBefore);

        $probe->configure($options);

        $optionsAfter = $this->readAttribute($probe, 'options');
        $this->assertArrayHasKey('testRequiredParam', $optionsAfter);
        $this->assertArrayHasKey('testOptionalParam', $optionsAfter);

        $this->assertEquals($optionsAfter['testRequiredParam'], 'default1');
        $this->assertEquals($optionsAfter['testOptionalParam'], 'value2');
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::check
     */
    public function testCheck()
    {
        $expectedOption = array(
            'testRequiredParam' => array(
                'name' => 'testRequiredParam', 'required' => true, 'type' => 'string', 'default' => 'default1')
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);

        $probe->configure(array());
        $probe->setAdapter(new TestAdapter());
        $probe->check();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::check
     */
    public function testCheckWithNoReasonExit()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_UNKNOWN);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $probe->setAdapter($adapter);
        $probe->check();
        $this->assertContains(ProbeInterface::NO_REASON_FAIL_MESSAGE, $probe->getErrorMessages());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::check
     */
    public function testCheckWithFailureAndLog()
    {
        $logger = $this->getMock('PhpProbe\Log\TestLogger');
        $logger->expects($this->once())->method('log')->withAnyParameters();

        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_FAILED);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $probe->setAdapter($adapter);
        $probe->setLogger($logger);
        $probe->check();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::check
     * @covers       PhpProbe\Probe\AbstractProbe::addChecker
     */
    public function testCheckWithSuccesfulCheckerAndNoLog()
    {
        $logger = $this->getMock('PhpProbe\Log\TestLogger');
        $logger->expects($this->never())->method('log')->withAnyParameters();

        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $adapter = new TestAdapter();
        $checker = new TestCheck();
        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->setLogger($logger);
        $probe->check();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::check
     * @covers       PhpProbe\Probe\AbstractProbe::getErrorMessages
     */
    public function testCheckWithFailingCheckerAndLog()
    {
        $logger = $this->getMock('PhpProbe\Log\TestLogger');
        $logger->expects($this->once())->method('log')->withAnyParameters();

        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $adapter = new TestAdapter();
        $error = array('Test error message');
        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->once())->method('check')->will($this->returnValue($error));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->setLogger($logger);
        $probe->check();
        $this->assertContains($error[0], $probe->getErrorMessages());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::setLogger
     */
    public function testSetLogger()
    {
        $logger = $this->getMock('PhpProbe\Log\TestLogger');
        $logger->expects($this->never())->method('log')->withAnyParameters();

        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $probe->setLogger($logger);
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkRequiredOption
     * @covers       PhpProbe\Probe\AbstractProbe::checkConfiguration
     */
    public function testCheckRequiredOptionRequired()
    {
        $expectedOption = array(
            'option' => array('name' => 'option', 'required' => true)
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);

        $this->setExpectedException('\PhpProbe\Exception\ConfigurationException');
        $probe->checkConfiguration();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkRequiredOption
     * @covers       PhpProbe\Probe\AbstractProbe::checkConfiguration
     */
    public function testCheckRequiredOptionNotRequired()
    {
        $expectedOption = array(
            'option' => array('name' => 'option', 'required' => false)
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);

        $probe->checkConfiguration();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkOptionType
     * @covers       PhpProbe\Probe\AbstractProbe::checkConfiguration
     */
    public function testCheckOptionTypeWithGoodType()
    {
        $options = array('stringOption' => 'hello world');

        $expectedOption = array(
            'stringOption' => array('name' => 'stringOption', 'required' => true, 'type' => 'string')
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions($options, $expectedOption);
        $probe->checkConfiguration();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkOptionType
     * @covers       PhpProbe\Probe\AbstractProbe::checkConfiguration
     */
    public function testCheckOptionTypeWithBadType()
    {
        $options = array('stringOption' => 1234); // Should be a string

        $expectedOption = array(
            'stringOption' => array('name' => 'stringOption', 'required' => true, 'type' => 'string')
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions($options, $expectedOption);
        $this->setExpectedException('\PhpProbe\Exception\ConfigurationException');
        $probe->checkConfiguration();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkConfiguration
     */
    public function testCheckConfigurationWithBadExpectedOption()
    {
        $expectedOption = array(
            'stringOption' => array('name' => '', 'required' => true, 'type' => 'string')
        );

        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);
        $this->setExpectedException('\PhpProbe\Exception\ConfigurationException');
        $probe->checkConfiguration();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::setAdapter
     * @covers       PhpProbe\Probe\AbstractProbe::getAdapter
     */
    public function testSetAdapter()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();
        $probe->setAdapter(new TestAdapter);
        $this->assertEquals(new TestAdapter(), $probe->getAdapter());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::__call
     */
    public function testMagicCall()
    {
        $expectedOption = array(
            'testoption' => array('name' => 'testoption', 'required' => true, 'type' => 'string')
        );
        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), $expectedOption);
        $this->assertFalse(method_exists($probe, 'testoption'));
        $probe->testoption('testValue');
        $options = $this->readAttribute($probe, 'options');
        $this->assertArrayHasKey('testoption', $options);
        $this->assertEquals('testValue', $options['testoption']);
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkAdapter
     */
    public function testCheckAdapterWithAdapter()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), array());
        $probe->checkAdapter();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::checkAdapter
     */
    public function testCheckAdapterWithNoAdapter()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions(array(), array(), false);
        $this->setExpectedException('\PhpProbe\Exception\ConfigurationException');
        $probe->checkAdapter();
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::hasPartiallySucceeded
     */
    public function testHasPartiallySucceeded()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $adapter = new TestAdapter();
        $error = array('Test error message');
        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->once())->method('check')->will($this->returnValue($error));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->check();
        $this->assertTrue($probe->hasPartiallySucceeded());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::hasFailed
     */
    public function testHasFailed()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_FAILED);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $error = array('Test error message');
        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->any())->method('check')->will($this->returnValue($error));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->check();
        $this->assertTrue($probe->hasFailed());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::hasSucceeded
     */
    public function testHasSucceeded()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_SUCCESSFUL);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->any())->method('check')->will($this->returnValue(array()));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->check();
        $this->assertTrue($probe->hasSucceeded());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::failed
     */
    public function testFailed()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_SUCCESSFUL);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->any())->method('check')->will($this->returnValue(array()));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->check();

        // At this point, probe should be succesful
        $this->assertTrue($probe->hasSucceeded());

        // Set probe as failed, we should get partial success (as response is succesful)
        $error = 'Error1';
        $probe->failed($error);
        $this->assertTrue($probe->hasPartiallySucceeded());
        $errors = array('Error2', 'Error3');
        $probe->failed($errors);
        $this->assertContains('Error1', $probe->getErrorMessages());
        $this->assertContains('Error2', $probe->getErrorMessages());
        $this->assertContains('Error3', $probe->getErrorMessages());
    }

    /**
     * @covers       PhpProbe\Probe\AbstractProbe::succeeded
     */
    public function testSucceeded()
    {
        $probe = $this->getProbeWithOptionsAndExpectedOptions();

        $response = new TestAdapterResponse();
        $response->setStatus(AdapterResponseInterface::STATUS_SUCCESSFUL);

        $adapter = $this->getMock('PhpProbe\Adapter\TestAdapter', array('getResponse'));
        $adapter->expects($this->any())->method('getResponse')->will($this->returnValue($response));

        $checker = $this->getMock('PhpProbe\Check\TestCheck', array('check'));
        $checker->expects($this->any())->method('check')->will($this->returnValue(array('Error')));

        $probe->addChecker($checker);
        $probe->setAdapter($adapter);
        $probe->check();

        // At this point, probe should be failure
        $this->assertTrue($probe->hasPartiallySucceeded());

        // Set probe as failed, we should get partial success (as response is succesful)
        $probe->succeeded();
        $this->assertTrue($probe->hasSucceeded());
    }
}


text:
using TeoVincent.EA.Common.Events;
using Xunit;

namespace TeoVincent.EA.Service.UnitTests.EventQueueTests
{
    public class PeekEventQueueTester : BaseEventQueueTester
    {
        [Fact]
        public void Add_Event_Peek_Event_Assert_Equal_Event()
        {
            // 2) act
            AEvent actual = queue.Peek(pluginName);
            AEvent expect = e;

            // 3) assert
            Assert.Equal(expect, actual);
        }

        [Fact]
        public void Add_Event_Peek_Event_Assert_Count()
        {
            // 2) act
            AEvent temp = queue.Peek(pluginName);
            int actual = queue.GetCount(pluginName);
            int expect = 1;

            // 3) assert
            Assert.Equal(expect, actual);
        }

        [Fact]
        public void Add_Event_Peek_Wrong_Event_Assert_Equal_Event()
        {
            // 1) arrange
            string wrongPluginName = "plugin";
            queue.Enqueue(pluginName, e);

            // 2) act
            AEvent actual = queue.Peek(wrongPluginName);
            AEvent expect = null;

            // 3) assert
            Assert.Equal(expect, actual);
        }

        [Fact]
        public void Add_Event_Peek_Wrong_Event_Assert_Count()
        {
            // 1) arrange
            string wrongPluginName = "plugin";

            // 2) act
            AEvent temp = queue.Peek(wrongPluginName);
            int actual = queue.GetCount(pluginName);
            int expect = 1;

            // 3) assert
            Assert.Equal(expect, actual);
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JSDoc: Index</title>

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">

Index

Seqjs

Parse nucleotide sequences

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="dist/seqJS.min.js"></script>
<script>
jQuery(function($) {
  $.awesome(); // "awesome"
});
</script>

Documentation

(Coming soon)

Examples

(Coming soon)

Release History

(Nothing yet)

Index

Classes

Feature

FeatureLocation

Location

Parser

Record

Seq

Span

SpanOperator

Namespaces

seqJS

Melt

    Documentation generated by JSDoc 3.2.2 on Fri Nov 07 2014 17:52:17 GMT-0000 (GMT)


text:
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from '@angular/router';

enum EXTERNAL_PAGES{
  DOCS = <any>'/reports/doc/',
  UNIT_TESTS = <any>'/reports/tests/unit-tests-results/',
  COVERAGE = <any>'/reports/coverage/PhantomJS 2.1.1 (Mac OS X 0.0.0)/html/'
}

@Component({
  selector: 'app-external-page',
  templateUrl: './external-page.component.html',
  styleUrls: ['./external-page.component.scss']
})
export class ExternalPageComponent implements OnInit {
  public pageUrl: string;
  private routeUrl:any = 'docs';

  constructor(private activatedRoute: ActivatedRoute) {
    this.routeUrl = <any>this.activatedRoute.snapshot.url.map(item => item.path).join('').toUpperCase();
    this.pageUrl = EXTERNAL_PAGES[this.routeUrl];
  }

  ngOnInit() {
  }

}


text:
package com.github.mlc.jgeographic.util;

import java.text.NumberFormat;
import java.util.Locale;
import com.github.mlc.jgeographic.GeographicException;

public class Utility {
    private Utility() {}
    public static String str(double x, int p) {
        if (Double.isInfinite(x)) {
            return (x < 0 ? "-inf" : "inf");
        } else if (Double.isNaN(x)) {
            return "nan";
        }
        if (p >= 0) {
            NumberFormat nf = NumberFormat.getInstance(Locale.US);
            nf.setGroupingUsed(false);
            nf.setMaximumFractionDigits(p);
            nf.setMinimumFractionDigits(p);
            return nf.format(x);
        } else {
            return Double.toString(x);
        }
    }

    public static double num(String s) {
        String errmsg;
        try {
            NumberFormat nf = NumberFormat.getInstance(Locale.US);
            Number x = nf.parse(s);
            return x.doubleValue();
        } catch (Exception e) {
            errmsg = e.getMessage();
        }

        double x = nummatch(s);
        if (x == 0)
            throw new GeographicException(errmsg);
        return x;
    }

    public static double nummatch(String s) {
        if (s.length() < 3)
            return 0;
        String t = s.toUpperCase(Locale.US);
        int sign = t.charAt(0) == '-' ? -1 : 1;
        int p0 = t.charAt(0) == '-' || t.charAt(0) == '+' ? 1 : 0;
        int p1 = find_last_not_of(t, '0');
        if (p1 == -1 || p1 + 1 < p0 + 3)
            return 0;
        // Strip off sign and trailing 0s
        t = t.substring(p0, p1 + 1);
        if (t.equals("NAN") || t.equals("1.#QNAN") || t.equals("1.#SNAN") || t.equals("1.#IND") ||
                t.equals("1.#R"))
            return Double.NaN;
        else if (t.equals("INF") || t.equals("1.#INF"))
            return sign < 1 ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
        return 0;
    }

    private static int find_last_not_of(String haystack, char needle) {
        for (int pos = haystack.length() - 1; pos >= 0; --pos) {
            if (haystack.charAt(pos) != needle)
                return pos;
        }
        return -1;
    }

    public static double fract(String s) {
        int delim = s.indexOf('/');
        return !(delim >= 1 && delim + 2 <= s.length()) ?
                num(s) :
                // delim in [1, size() - 2]
                num(s.substring(0, delim)) / num(s.substring(delim + 1));
    }
}


text:
package io.qubite.tomoko.operation;

import io.qubite.tomoko.handler.value.ValueHandler;
import io.qubite.tomoko.handler.valueless.ValuelessHandler;
import io.qubite.tomoko.patch.ValueTree;
import io.qubite.tomoko.path.Path;

public class Operations {

    private Operations() {
    }

    public static ValueOperation value(Path path, ValueHandler handler, ValueTree value) {
        return new ValueOperation(path, handler, value);
    }

    public static ValuelessOperation valueless(Path path, ValuelessHandler handler) {
        return new ValuelessOperation(path, handler);
    }

}


text:
class MessageLoop;

struct AVCodecContext;
struct AVFrame;

namespace media {

class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
 public:
  FFmpegVideoDecoder(const base::Callback<MessageLoop*()>& message_loop_cb);
  virtual ~FFmpegVideoDecoder();

  // Filter implementation.
  virtual void Stop(const base::Closure& callback) OVERRIDE;
  virtual void Seek(base::TimeDelta time, const PipelineStatusCB& cb) OVERRIDE;
  virtual void Pause(const base::Closure& callback) OVERRIDE;
  virtual void Flush(const base::Closure& callback) OVERRIDE;

  // VideoDecoder implementation.
  virtual void Initialize(DemuxerStream* demuxer_stream,
                          const PipelineStatusCB& status_cb,
                          const StatisticsCB& statistics_cb) OVERRIDE;
  virtual void Read(const ReadCB& read_cb) OVERRIDE;
  virtual const gfx::Size& natural_size() OVERRIDE;

 private:
  enum DecoderState {
    kUninitialized,
    kNormal,
    kFlushCodec,
    kDecodeFinished,
  };

  // Carries out the reading operation scheduled by Read().
  void DoRead(const ReadCB& read_cb);

  // Reads from the demuxer stream with corresponding callback method.
  void ReadFromDemuxerStream();
  void DecodeBuffer(const scoped_refptr<Buffer>& buffer);

  // Carries out the decoding operation scheduled by DecodeBuffer().
  void DoDecodeBuffer(const scoped_refptr<Buffer>& buffer);
  bool Decode(const scoped_refptr<Buffer>& buffer,
              scoped_refptr<VideoFrame>* video_frame);

  // Delivers the frame to |read_cb_| and resets the callback.
  void DeliverFrame(const scoped_refptr<VideoFrame>& video_frame);

  // Releases resources associated with |codec_context_| and |av_frame_|
  // and resets them to NULL.
  void ReleaseFFmpegResources();

  // Flush decoder and call |flush_cb_|.
  void DoFlush();

  // Allocates a video frame based on the current format and dimensions based on
  // the current state of |codec_context_|.
  scoped_refptr<VideoFrame> AllocateVideoFrame();

  // This is !is_null() iff Initialize() hasn't been called.
  base::Callback<MessageLoop*()> message_loop_factory_cb_;

  MessageLoop* message_loop_;

  DecoderState state_;

  StatisticsCB statistics_cb_;

  ReadCB read_cb_;
  base::Closure flush_cb_;

  // FFmpeg structures owned by this object.
  AVCodecContext* codec_context_;
  AVFrame* av_frame_;

  // Frame rate of the video.
  int frame_rate_numerator_;
  int frame_rate_denominator_;

  // TODO(scherkus): I think this should be calculated by VideoRenderers based
  // on information provided by VideoDecoders (i.e., aspect ratio).
  gfx::Size natural_size_;

  // Pointer to the demuxer stream that will feed us compressed buffers.
  scoped_refptr<DemuxerStream> demuxer_stream_;

  AesDecryptor decryptor_;

  DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
};

}  // namespace media

#endif  // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_


text:
package net.yrom.screenrecorder;

import android.media.MediaCodec;
import android.media.MediaFormat;
import android.util.Log;
import android.view.Surface;

import java.util.Objects;

/**
 * @author yrom
 * @version 2017/12/3
 */
class VideoEncoder extends BaseEncoder {
    private static final boolean VERBOSE = false;
    private VideoEncodeConfig mConfig;
    private Surface mSurface;

    VideoEncoder(VideoEncodeConfig config) {
        super(config.codecName);
        this.mConfig = config;
    }

    @Override
    protected void onEncoderConfigured(MediaCodec encoder) {
        mSurface = encoder.createInputSurface();
        if (VERBOSE) Log.i("@@", "VideoEncoder create input surface: " + mSurface);
    }

    @Override
    protected MediaFormat createMediaFormat() {
        return mConfig.toFormat();
    }

    /**
     * @throws NullPointerException if prepare() not call
     */
    Surface getInputSurface() {
        return Objects.requireNonNull(mSurface, "doesn't prepare()");
    }

    @Override
    public void release() {
        if (mSurface != null) {
            mSurface.release();
            mSurface = null;
        }
        super.release();
    }

}


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=enum.DeviceLocalMemType.html">

Redirecting to enum.DeviceLocalMemType.html...


text:
package com.samsung.sec.dexter.findbugs.plugin;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.ASTVisitor;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.TypeDeclaration;

import com.samsung.sec.dexter.core.config.DexterConfig;
import com.samsung.sec.dexter.core.util.DexterUtil;

public class JdtUtil {
	public synchronized static List<String> getTypeNameList(final String fileFullPath) {
		ASTParser parser = ASTParser.newParser(AST.JLS4);

		final String sourcecode = DexterUtil.getContentsFromFile(fileFullPath, DexterConfig.getInstance().getSourceEncoding());
		parser.setSource(sourcecode.toCharArray());
		parser.setKind(ASTParser.K_COMPILATION_UNIT);
		final CompilationUnit cu = (CompilationUnit) parser.createAST(null);

		return findTypeNameList(cu);
	}

	private static List<String> findTypeNameList(final CompilationUnit cu) {
		final List<String> typeNameList = new ArrayList<String>();

		cu.accept(new ASTVisitor() {
			@Override
			public boolean visit(TypeDeclaration node) {
				typeNameList.add(node.getName().getIdentifier());
				return super.visit(node);
			}
		});

		return typeNameList;
    }

	public static List<String> getClassAndSubClassFullPathList(final String binFullPath,
			final String modulePath, final String sourceFileFullPath) {

		final List<String> classFileList = new ArrayList<String>();
		final List<String> typeNameList = getTypeNameList(sourceFileFullPath);
		final String baseClassPath = DexterUtil.addPaths(binFullPath, modulePath);
		final File[] subFileList = DexterUtil.getSubFiles(baseClassPath);

		for (final String typeName : typeNameList) {
			final String classFullPath = DexterUtil.addPaths(baseClassPath, typeName + ".class");
			classFileList.add(classFullPath);

			final String classFullPathWithoutExtension = classFullPath.substring(0, classFullPath.length() - 6) + "$";

			for(File sub : subFileList){
				String subPath = DexterUtil.refinePath(sub.getAbsolutePath());
				if(subPath.startsWith(classFullPathWithoutExtension)){
					classFileList.add(subPath);
				}
			}
		}

		return classFileList;
    }
}


text:
<?php
/**
 * @package    CleverStyle Framework
 * @subpackage System module
 * @category   modules
 * @author     Nazar Mokrynskyi <nazar@mokrynskyi.com>
 * @license    0BSD
 */
namespace cs\modules\System\api\Controller\admin;
use
	cs\ExitException,
	cs\Group,
	cs\Response;

trait groups {
	/**
	 * Get array of groups data or data of specific group if id specified or data of several specified groups if specified in ids query parameter
	 *
	 * @param \cs\Request $Request
	 *
	 * @return array|array[]
	 *
	 * @throws ExitException
	 */
	public static function admin_groups___get ($Request) {
		$Group = Group::instance();
		$id    = $Request->route_ids(0);
		$ids   = $Request->query('ids');
		if ($id) {
			$result = $Group->get($id);
		} elseif ($ids) {
			$result = $Group->get(explode(',', $ids));
		} else {
			$result = $Group->get($Group->get_all());
		}
		if (!$result) {
			throw new ExitException(404);
		}
		return $result;
	}
	/**
	 * Add new group
	 *
	 * @param \cs\Request $Request
	 *
	 * @throws ExitException
	 */
	public static function admin_groups___post ($Request) {
		$data = $Request->data('title', 'description');
		if (!$data) {
			throw new ExitException(400);
		}
		if (Group::instance()->add(...array_values($data))) {
			Response::instance()->code = 201;
		} else {
			throw new ExitException(500);
		}
	}
	/**
	 * Update group's data
	 *
	 * @param \cs\Request $Request
	 *
	 * @throws ExitException
	 */
	public static function admin_groups___put ($Request) {
		$id   = $Request->route_ids(0);
		$data = $Request->data('title', 'description');
		if (!$id || !$data) {
			throw new ExitException(400);
		}
		if (!Group::instance()->set($id, ...array_values($data))) {
			throw new ExitException(500);
		}
	}
	/**
	 * Delete group
	 *
	 * @param \cs\Request $Request
	 *
	 * @throws ExitException
	 */
	public static function admin_groups___delete ($Request) {
		$id = $Request->route_ids(0);
		if (!$id) {
			throw new ExitException(400);
		}
		if (!Group::instance()->del($id)) {
			throw new ExitException(500);
		}
	}
	/**
	 * Get group's permissions
	 *
	 * @param \cs\Request $Request
	 *
	 * @return array
	 *
	 * @throws ExitException
	 */
	public static function admin_groups_permissions_get ($Request) {
		$id = $Request->route_ids(0);
		if (!$id) {
			throw new ExitException(400);
		}
		return Group::instance()->get_permissions($id) ?: [];
	}
	/**
	 * Update group's permissions
	 *
	 * @param \cs\Request $Request
	 *
	 * @throws ExitException
	 */
	public static function admin_groups_permissions_put ($Request) {
		$id          = $Request->route_ids(0);
		$permissions = $Request->data('permissions');
		if (!$id || !$permissions) {
			throw new ExitException(400);
		}
		if (!Group::instance()->set_permissions($permissions, $id)) {
			throw new ExitException(500);
		}
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>FailureDetectorMBean (apache-cassandra API)</title>
<meta name="date" content="2016-04-09">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.apache.cassandra.gms

Interface FailureDetectorMBean

All Known Implementing Classes:

FailureDetector

public interface FailureDetectorMBean

Method Summary

All Methods Instance Methods Abstract Methods

Modifier and Type
Method and Description

void
dumpInterArrivalTimes()

java.lang.String
getAllEndpointStates()

int
getDownEndpointCount()

java.lang.String
getEndpointState(java.lang.String address)

double
getPhiConvictThreshold()

javax.management.openmbean.TabularData
getPhiValues()

java.util.Map<java.lang.String,java.lang.String>
getSimpleStates()

int
getUpEndpointCount()

void
setPhiConvictThreshold(double phi)

Method Detail

dumpInterArrivalTimes

void dumpInterArrivalTimes()

setPhiConvictThreshold

void setPhiConvictThreshold(double phi)

getPhiConvictThreshold

double getPhiConvictThreshold()

getAllEndpointStates

java.lang.String getAllEndpointStates()

getEndpointState

java.lang.String getEndpointState(java.lang.String address)
                           throws java.net.UnknownHostException

Throws:

java.net.UnknownHostException

getSimpleStates

java.util.Map<java.lang.String,java.lang.String> getSimpleStates()

getDownEndpointCount

int getDownEndpointCount()

getUpEndpointCount

int getUpEndpointCount()

getPhiValues

javax.management.openmbean.TabularData getPhiValues()
                                             throws javax.management.openmbean.OpenDataException

Throws:

javax.management.openmbean.OpenDataException

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

Copyright © 2016 The Apache Software Foundation


text:
"""
Custom exceptions for things that can go wrong in the
execution of changesets.

These are used more for documentation than functionality
at the moment.
"""

class ChangesetException(Exception):
    pass

class NotEnoughApprovals(ChangesetException):
    pass

class NotPermittedToApprove(ChangesetException):
    pass

class NotPermittedToQueue(ChangesetException):
    pass

class NotInApprovableStatus(ChangesetException):
    pass

class NotApprovedBy(ChangesetException):
    pass

class NotAnAllowedStatus(ChangesetException):
    pass


text:
	express = require('express')
	app = express()
	path = require('path')
	fs = require('fs')
	api_key = process.env.APIKEY
	domain = process.env.DOMAIN
	mailgun = require('mailgun-js')({apiKey: api_key, domain: domain})
	port = 9999
	projectPath = path.join(__dirname) + '/'
	attachFileName = undefined
	attachFilePath = '/data/'
	allowCrossDomain = function(req, res, next) {
		res.header("Access-Control-Allow-Origin", "*")
		res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept")
		res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE')
		res.header("Content-Type", "application/json; charset=utf-8")
    		next();
	}
	mailTemplate  = {
		"from": "Mailgun Sandbox <postmaster@YOURDOMAIN.mailgun.org>",
		"to": "toSomeOne <email>",
		"subject": "test mail!",
		"text": "TEST API for Docker",
		"attachment": 'attachFileName'
	}
	app.use(express.bodyParser())
	app.use(allowCrossDomain)

	app.post('/sendmail/:file?', function(req, res) {
		var data = req.body || {}
			attachFileName = attachFilePath + req.body.attachment
		data.attachment = (fs.existsSync(attachFileName)) ? attachFileName: undefined
		if (Object.keys(data).length === 1 && data.hasOwnProperty('attachment')) {
			res.send({msg: 'not enough mail content', YouShouldUse: mailTemplate })
			console.log('not enough mail content')
			return
		}
		mailgun.messages().send(data, function (error, body) {
		  	if (error) {
		  		console.log('error when send mail :', error, body)
		  		data.msg = "sendMail! FAILD!"
				res.send(data)
				return
		  	}
		  	data.msg = "sendMail! OK!"
		  	console.log(data)
		  	res.send(data)
		})
	})
	app.get('/:test?', function(req, res) {
		res.send({
			reqbody: req.body,
			params: req.params.test,
			msg: 'yooo test',
			attachment: req.params.test,
			projectPath: projectPath,
			mailTemplate: mailTemplate
		})
	})
	app.post('/:test?', function(req, res) {
		res.send({
			reqbody: req.body,
			params: req.params.test,
			msg: 'yooo test',
			attachment: req.params.test,
			projectPath: projectPath,
			mailTemplate: mailTemplate
		})
	})

app.listen(port)
console.log('Listening on port ' + port)


text:
package org.apache.nifi.controller.reporting;

import org.apache.nifi.annotation.behavior.Restricted;
import org.apache.nifi.authorization.Resource;
import org.apache.nifi.authorization.resource.Authorizable;
import org.apache.nifi.authorization.resource.ResourceFactory;
import org.apache.nifi.authorization.resource.ResourceType;
import org.apache.nifi.controller.FlowController;
import org.apache.nifi.controller.LoggableComponent;
import org.apache.nifi.controller.ProcessScheduler;
import org.apache.nifi.controller.ReportingTaskNode;
import org.apache.nifi.controller.ValidationContextFactory;
import org.apache.nifi.registry.VariableRegistry;
import org.apache.nifi.reporting.ReportingContext;
import org.apache.nifi.reporting.ReportingTask;

public class StandardReportingTaskNode extends AbstractReportingTaskNode implements ReportingTaskNode {

    private final FlowController flowController;

    public StandardReportingTaskNode(final LoggableComponent<ReportingTask> reportingTask, final String id, final FlowController controller,
                                     final ProcessScheduler processScheduler, final ValidationContextFactory validationContextFactory,
                                     final VariableRegistry variableRegistry) {
        super(reportingTask, id, controller, processScheduler, validationContextFactory, variableRegistry);
        this.flowController = controller;
    }

    public StandardReportingTaskNode(final LoggableComponent<ReportingTask> reportingTask, final String id, final FlowController controller,
                                     final ProcessScheduler processScheduler, final ValidationContextFactory validationContextFactory,
                                     final String componentType, final String canonicalClassName, final VariableRegistry variableRegistry,
                                     final boolean isExtensionMissing) {
        super(reportingTask, id, controller, processScheduler, validationContextFactory, componentType, canonicalClassName,variableRegistry, isExtensionMissing);
        this.flowController = controller;
    }

    @Override
    public Authorizable getParentAuthorizable() {
        return flowController;
    }

    @Override
    public Resource getResource() {
        return ResourceFactory.getComponentResource(ResourceType.ReportingTask, getIdentifier(), getName());
    }

    @Override
    public boolean isRestricted() {
        return getReportingTask().getClass().isAnnotationPresent(Restricted.class);
    }

    @Override
    public ReportingContext getReportingContext() {
        return new StandardReportingContext(flowController, flowController.getBulletinRepository(), getProperties(), flowController, getReportingTask(), getVariableRegistry());
    }
}


text:
package org.ambraproject.rhino.model.ingest;

import org.ambraproject.rhino.model.article.ArticleCustomMetadata;
import org.ambraproject.rhino.model.article.ArticleMetadata;

import java.util.Objects;

public class IngestPackage {
  private final ArticlePackage articlePackage;
  private final ArticleMetadata articleMetadata;
  private final ArticleCustomMetadata articleCustomMetadata;

  public IngestPackage(ArticlePackage articlePackage, ArticleMetadata articleMetadata,
                       ArticleCustomMetadata customMetadata) {
    this.articlePackage = Objects.requireNonNull(articlePackage);
    this.articleMetadata = Objects.requireNonNull(articleMetadata);
    this.articleCustomMetadata = Objects.requireNonNull(customMetadata);
  }

  public ArticlePackage getArticlePackage() {
    return articlePackage;
  }

  public ArticleMetadata getArticleMetadata() {
    return articleMetadata;
  }

  public ArticleCustomMetadata getArticleCustomMetadata() {
    return articleCustomMetadata;
  }
}