text:
#ifndef _MGL_BIT_FLAG_MGL_
#define _MGL_BIT_FLAG_MGL_

#include <cstdint>
#include <min/static_vector.h>
#include <utility>

namespace min
{
// Typename must be an unsigned integer type
template <typename K, typename L>
class bit_flag
{
  private:
    min::static_vector<uint8_t> _flags;
    K _col;
    K _row;

    inline std::pair<L, uint_fast8_t> get_address(const L row, const L col) const
    {
        // Divide by 8 to get into bytes
        const L position = (row * _col) + col;
        const L byte = position >> 3;

        // Get the offset
        // 0-7 value
        const uint_fast8_t offset = position % 8;

        // Return address
        return std::make_pair(byte, offset);
    }
    static inline L calc_size(const L row, const L col)
    {
        return (row * col >> 3) + 1;
    }

  public:
    bit_flag() : _col(0), _row(0) {}
    bit_flag(const L row, const L col)
        : _flags(calc_size(row, col)), _col(col), _row(row)
    {
        clear();
    }
    inline void clear()
    {
        _flags.zero();
    }
    inline bool get(const K row, const K col) const
    {
        // Get the address
        const std::pair<L, uint_fast8_t> addr = get_address(row, col);

        // Return 1 if on and zero if off
        return (_flags[addr.first] >> addr.second) & 0x1;
    }
    inline bool get_set_on(const K row, const K col)
    {
        // Get the address
        const std::pair<L, uint_fast8_t> addr = get_address(row, col);

        // Cache shift for the read/write operation
        const auto shift = (0x1 << addr.second);

        // Return 1 if on and zero if off
        const bool out = _flags[addr.first] & shift;

        // Set bit on
        _flags[addr.first] |= shift;

        return out;
    }
    inline void resize(const L row, const L col)
    {
        // Resize the flag buffer
        _flags.resize(calc_size(row, col));

        // Capture new size
        _col = col;
        _row = row;

        // Initialize memory
        clear();
    }
    inline void set_on(const K row, const K col)
    {
        // Get the address
        const std::pair<L, uint_fast8_t> addr = get_address(row, col);
        _flags[addr.first] |= (0x1 << addr.second);
    }
    inline void set_off(const K row, const K col)
    {
        // Get the address
        const std::pair<L, uint_fast8_t> addr = get_address(row, col);
        _flags[addr.first] &= ~(0x1 << addr.second);
    }
    inline K col() const
    {
        return _col;
    }
    inline K row() const
    {
        return _row;
    }
};
}

#endif


text:
package org.jbake.model;

import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;

import org.jbake.parser.Engines;

/**
 * Utility class used to determine the list of document types. Currently only supports "page", "post", "index",
 * "archive" and "feed".
 * <p/>
 * Additional document types are added at runtime based on the types found in the configuration.
 *
 * @author Cédric Champeau
 */
public class DocumentTypes {

    private static final Set<String> DEFAULT_DOC_TYPES = new LinkedHashSet<String>(Arrays.asList("page", "post", "masterindex", "archive", "feed"));

    private static final Set<DocumentTypeListener> LISTENERS = new HashSet<DocumentTypeListener>();

    public static void addDocumentType(String docType) {
        DEFAULT_DOC_TYPES.add(docType);
        notifyListener(docType);
    }

    private static void notifyListener(String docType) {
        for ( DocumentTypeListener listener : LISTENERS) {
            listener.added(docType);
        }
    }

    public static void addListener( DocumentTypeListener listener ) {
        LISTENERS.add(listener);
    }

    /**
     * Notice additional document types are added automagically before returning them
     * @return all supported document types
     */
    public static String[] getDocumentTypes() {
    	// TODO: is this needed?
        // make sure engines are loaded before to get document types
        Engines.getRecognizedExtensions();
        return DEFAULT_DOC_TYPES.toArray(new String[DEFAULT_DOC_TYPES.size()]);
    }

    public static boolean contains(String documentType) {
        return DEFAULT_DOC_TYPES.contains(documentType);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package eportfolium.com.karuta.webapp.eventbus;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Iterator;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.springframework.util.MimeTypeUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

import eportfolium.com.karuta.business.contract.NodeManager;
import eportfolium.com.karuta.business.contract.PortfolioManager;
import eportfolium.com.karuta.business.contract.UserManager;

public class HandlerNotificationSakai implements KEventHandler {
	HttpServletRequest httpServletRequest;
	HttpSession session;
	long userId;
	long groupId;
	String username;
	NodeManager nodeManager;
	UserManager userManager;
	PortfolioManager portfolioManager;
	String ticket;
	String sessionCookie;

	public HandlerNotificationSakai(HttpServletRequest request, NodeManager nodeManager, UserManager userManager,
			PortfolioManager portfolioManager) {
		httpServletRequest = request;
		this.nodeManager = nodeManager;
		this.userManager = userManager;
		this.portfolioManager = portfolioManager;

		this.session = request.getSession(true);
		Integer val = (Integer) session.getAttribute("uid");
		if (val != null)
			this.userId = val;
		val = (Integer) session.getAttribute("gid");
		if (val != null)
			this.groupId = val;
		this.username = (String) session.getAttribute("user");
	}

	@Override
	public boolean processEvent(KEvent event) {
		if (event == null || event.requestType == null)
			return false;
		try {
			switch (event.requestType) {
			case POST:
			case PUT:
				switch (event.eventType) {
				case NODE:

					/// Récupérer la liste des roles à notifier
					Set<String[]> notif = userManager.getNotificationUserList(userId, groupId, event.uuid);

					if (notif.isEmpty())
						return false;

					String context = nodeManager
							.getNode(MimeTypeUtils.TEXT_XML, event.uuid, true, this.userId, this.groupId, null, null)
							.toString();
					Document docContext = parseString(context);
					NodeList res = docContext.getElementsByTagName("asmResource");
					String blah = "";
					for (int i = 0; i < res.getLength(); ++i) {
						Node r = res.item(i);
						String type = r.getAttributes().getNamedItem("xsi_type").getNodeValue();
						if ("nodeRes".equals(type)) {
							NodeList childs = r.getChildNodes();
							for (int j = 0; j < childs.getLength(); ++j) {
								Node c = childs.item(j);
								String cname = c.getNodeName();
								if ("label".equals(cname)) {
									String lang = c.getAttributes().getNamedItem("lang").getNodeValue();
									if ("fr".equals(lang)) {
										blah = c.getTextContent();
										break;
									}
								}
							}
							break;
						}
					}

					Iterator<String[]> userIter = notif.iterator();

					Document doc = parseString(event.inputData);
					doc.getElementsByTagName("");

					String portfolio = portfolioManager.getPortfolioUuidFromNode(event.uuid);

					getSakaiTicket();

					String log = "ticket:" + ticket + ";";
					while (userIter.hasNext()) {
						String[] val = userIter.next();
						String user = val[0];
						String lastname = val[1];
						int status = sendMessage(user, lastname + ", user: " + username + " edited '" + blah + "' @ "
								+ event.uuid + " in portfolio " + portfolio);
						log += user + ":" + status + ";";
					}

					System.out.println(log);
					break;

				default:
					break;
				}
				break;

			default:
				break;
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}

		return true;
	}

	int sendMessage(String user, String message) {
		int ret = 500;

		try {
			String urlParameters = "notification=\"" + message + "\"&_sessionId=" + ticket;

			/// Send for this user
			URL urlTicker = new URL("http://osp2.threecanoes.com/direct/notify/post/" + user);

			HttpURLConnection connect = (HttpURLConnection) urlTicker.openConnection();
			connect.setDoOutput(true);
			connect.setDoInput(true);
			connect.setInstanceFollowRedirects(false);
			connect.setRequestMethod("POST");
			connect.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
			connect.setRequestProperty("charset", "utf-8");
			connect.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
			connect.setUseCaches(false);
			connect.setRequestProperty("Cookie", sessionCookie);
			connect.connect();

			DataOutputStream wr = new DataOutputStream(connect.getOutputStream());
			wr.writeBytes(urlParameters);
			wr.flush();
			wr.close();

			ret = connect.getResponseCode();

			System.out.println("Notification:" + ret);
		} catch (Exception e) {
			e.printStackTrace();
		}

		return ret;
	}

	boolean getSakaiTicket() {
		boolean ret = true;
		try {
			/// Configurable?
			String urlParameters = "_username=testadmin&_password=testadmin";

			/// Will have to use some context config
			URL urlTicker = new URL("http://osp2.threecanoes.com/direct/session");

			HttpURLConnection connect = (HttpURLConnection) urlTicker.openConnection();
			connect.setDoOutput(true);
			connect.setDoInput(true);
			connect.setInstanceFollowRedirects(false);
			connect.setRequestMethod("POST");
			connect.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
			connect.setRequestProperty("charset", "utf-8");
			connect.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
			connect.setUseCaches(false);
			connect.connect();

			DataOutputStream wr = new DataOutputStream(connect.getOutputStream());
			wr.writeBytes(urlParameters);
			wr.flush();
			wr.close();

			StringBuilder readTicket = new StringBuilder();
			BufferedReader rd = new BufferedReader(new InputStreamReader(connect.getInputStream(), "UTF-8"));
			char buffer[] = new char[1024];
			int offset = 0;
			int read = 0;
			do {
				read = rd.read(buffer, offset, 1024);
				offset += read;
				readTicket.append(buffer);
			} while (read == 1024);
			rd.close();

			sessionCookie = connect.getHeaderField("Set-Cookie");

			connect.disconnect();

			ticket = readTicket.toString();
		} catch (Exception e) {
			e.printStackTrace();
			ret = false;
		}

		return ret;
	}

	Document parseString(String data)
			throws UnsupportedEncodingException, SAXException, IOException, ParserConfigurationException {
		DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
		DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
		Document doc = documentBuilder.parse(new ByteArrayInputStream(data.getBytes("UTF-8")));
		doc.setXmlStandalone(true);

		return doc;
	}

}


text: this is file 58


text:
package org.apache.logging.log4j.core.appender.db.jpa;

import static org.junit.Assert.assertNull;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.test.categories.Appenders;
import org.junit.Test;
import org.junit.experimental.categories.Category;

@Category(Appenders.Jpa.class)
public class JpaHsqldbAppenderTest extends AbstractJpaAppenderTest {
    private static final String USER_ID = "sa";
    private static final String PASSWORD = "123";

    public JpaHsqldbAppenderTest() {
        super("hsqldb");
    }

    @Override
    protected Connection setUpConnection() throws SQLException {
        final Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:Log4j", USER_ID, PASSWORD);

        try (Statement statement = connection.createStatement()) {
            statement.executeUpdate("CREATE TABLE jpaBaseLogEntry ( "
                    + "id INTEGER IDENTITY, eventDate DATETIME, instant NVARCHAR(64), level VARCHAR(10), "
                    + "logger VARCHAR(255), message VARCHAR(1024), exception VARCHAR(1048576) )");
        }

        try (Statement statement = connection.createStatement()) {
            statement.executeUpdate("CREATE TABLE jpaBasicLogEntry ( "
                    + "id INTEGER IDENTITY, timemillis BIGINT, instant NVARCHAR(64), nanoTime BIGINT, "
                    + "level VARCHAR(10), loggerName VARCHAR(255), message VARCHAR(1024), thrown VARCHAR(1048576), "
                    + "contextMapJson VARCHAR(1048576), loggerFQCN VARCHAR(1024), "
                    + "contextStack VARCHAR(1048576), marker VARCHAR(255), source VARCHAR(2048),"
                    + "threadId BIGINT, threadName NVARCHAR(255), threadPriority INTEGER )");
        }

        return connection;
    }

    @Test
    public void testNoEntityClassName() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, null, "jpaAppenderTestUnit");

        assertNull("The appender should be null.", appender);
    }

    @Test
    public void testNoPersistenceUnitName() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, TestBaseEntity.class.getName(),
                null);

        assertNull("The appender should be null.", appender);
    }

    @Test
    public void testBadEntityClassName() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, "com.foo.Bar",
                "jpaAppenderTestUnit");

        assertNull("The appender should be null.", appender);
    }

    @Test
    public void testNonLogEventEntity() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null, Object.class.getName(),
                "jpaAppenderTestUnit");

        assertNull("The appender should be null.", appender);
    }

    @Test
    public void testBadConstructorEntity01() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null,
                BadConstructorEntity1.class.getName(), "jpaAppenderTestUnit");

        assertNull("The appender should be null.", appender);
    }

    @Test
    public void testBadConstructorEntity02() {
        final JpaAppender appender = JpaAppender.createAppender("name", null, null, null,
                BadConstructorEntity2.class.getName(), "jpaAppenderTestUnit");

        assertNull("The appender should be null.", appender);
    }

    @SuppressWarnings("unused")
    public static class BadConstructorEntity1 extends TestBaseEntity {
        private static final long serialVersionUID = 1L;

        public BadConstructorEntity1(final LogEvent wrappedEvent) {
            super(wrappedEvent);
        }
    }

    @SuppressWarnings("unused")
    public static class BadConstructorEntity2 extends TestBaseEntity {
        private static final long serialVersionUID = 1L;

        public BadConstructorEntity2() {
            super(null);
        }

        public BadConstructorEntity2(final LogEvent wrappedEvent, final String badParameter) {
            super(wrappedEvent);
        }
    }
}


text:
@implementation UICollectionViewCell (RMRegisterCell)

+ (NSString *)cellIdentifier {
    return NSStringFromClass([self class]);
}

+ (void)registerCellInCollectionView:(UICollectionView *)collectionView {
    UINib *nib = [UINib nibWithNibName:[self cellIdentifier] bundle:nil];
    [collectionView registerNib:nib forCellWithReuseIdentifier:[self cellIdentifier]];
}

@end

@implementation UICollectionReusableView (RMRegisterCell)

+ (NSString *)cellIdentifier {
    return NSStringFromClass([self class]);
}

+ (void)registerCellInCollectionView:(UICollectionView *)collectionView {
    UINib *nib = [UINib nibWithNibName:[self cellIdentifier] bundle:nil];
    [collectionView registerNib:nib forSupplementaryViewOfKind:UICollectionElementKindSectionHeader
            withReuseIdentifier:[self cellIdentifier]];
}

@end


text:
enyo.Spotlight.Muter = new function() {
	var _oMutes = {},
		_nMutes = 0;

	this.addMuteReason = function(oSender) {
		if (typeof _oMutes[oSender.id] != 'undefined') { return; }

		if (_nMutes === 0) {
			var oCurrent = enyo.Spotlight.getCurrent();
			if (oCurrent) { oCurrent.removeClass('spotlight'); }
		}

		_oMutes[oSender.id] = 1;
		_nMutes ++;
	};

	this.removeMuteReason = function(oSender) {
		if (typeof _oMutes[oSender.id] == 'undefined') { return; }

		delete _oMutes[oSender.id];
		_nMutes --;

		if (_nMutes === 0) {
			var oCurrent = enyo.Spotlight.getCurrent();
			if (oCurrent) { oCurrent.addClass('spotlight'); }
		}
	};

	this.isMuted = function() {
		return _nMutes > 0;
	};
};


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.jena.riot.writer Class Hierarchy (Apache Jena ARQ)</title>
<meta name="date" content="2015-12-08">
<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

Next

Frames

No Frames

All Classes

Hierarchy For Package org.apache.jena.riot.writer

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

org.apache.jena.riot.writer.NullWriter (implements org.apache.jena.riot.WriterDatasetRIOT)

org.apache.jena.riot.writer.StreamWriterTriX (implements org.apache.jena.riot.system.StreamRDF)

org.apache.jena.riot.writer.TurtleShell

org.apache.jena.riot.writer.WriterConst

org.apache.jena.riot.writer.WriterDatasetRIOTBase (implements org.apache.jena.riot.WriterDatasetRIOT)

org.apache.jena.riot.writer.NQuadsWriter

org.apache.jena.riot.writer.TriGWriterBase

org.apache.jena.riot.writer.TriGWriter

org.apache.jena.riot.writer.TriGWriterBlocks

org.apache.jena.riot.writer.TriGWriterFlat

org.apache.jena.riot.writer.WriterGraphRIOTBase (implements org.apache.jena.riot.WriterGraphRIOT)

org.apache.jena.riot.adapters.AdapterRDFWriter

org.apache.jena.riot.writer.RDFXMLAbbrevWriter

org.apache.jena.riot.writer.RDFXMLPlainWriter

org.apache.jena.riot.writer.NTriplesWriter

org.apache.jena.riot.writer.RDFJSONWriter

org.apache.jena.riot.writer.TurtleWriterBase

org.apache.jena.riot.writer.TurtleWriter

org.apache.jena.riot.writer.TurtleWriterBlocks

org.apache.jena.riot.writer.TurtleWriterFlat

org.apache.jena.riot.writer.WriterStreamRDFBase (implements org.apache.jena.riot.system.StreamRDF)

org.apache.jena.riot.writer.WriterStreamRDFBlocks

org.apache.jena.riot.writer.WriterStreamRDFFlat

org.apache.jena.riot.writer.WriterStreamRDFPlain (implements org.apache.jena.riot.system.StreamRDF)

org.apache.jena.riot.writer.WriterTriX (implements org.apache.jena.riot.WriterDatasetRIOT, org.apache.jena.riot.WriterGraphRIOT)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Licenced under the Apache License, Version 2.0


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class crash_pic
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.pnl_holdtogether = New System.Windows.Forms.Panel()
        Me.killme = New System.Windows.Forms.Timer(Me.components)
        Me.pic_crash = New System.Windows.Forms.PictureBox()
        Me.pnl_holdtogether.SuspendLayout()
        CType(Me.pic_crash, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'pnl_holdtogether
        '
        Me.pnl_holdtogether.Controls.Add(Me.pic_crash)
        Me.pnl_holdtogether.Dock = System.Windows.Forms.DockStyle.Fill
        Me.pnl_holdtogether.Location = New System.Drawing.Point(0, 0)
        Me.pnl_holdtogether.Name = "pnl_holdtogether"
        Me.pnl_holdtogether.Size = New System.Drawing.Size(728, 422)
        Me.pnl_holdtogether.TabIndex = 1
        '
        'killme
        '
        Me.killme.Interval = 10000
        '
        'pic_crash
        '
        Me.pic_crash.Dock = System.Windows.Forms.DockStyle.Fill
        Me.pic_crash.Image = Global.ShiftOS.My.Resources.Resources.crash_cheat
        Me.pic_crash.Location = New System.Drawing.Point(0, 0)
        Me.pic_crash.Name = "pic_crash"
        Me.pic_crash.Size = New System.Drawing.Size(728, 422)
        Me.pic_crash.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
        Me.pic_crash.TabIndex = 0
        Me.pic_crash.TabStop = False
        '
        'crash_pic
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackgroundImage = Global.ShiftOS.My.Resources.Resources.crash_cheat
        Me.ClientSize = New System.Drawing.Size(728, 422)
        Me.Controls.Add(Me.pnl_holdtogether)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.Name = "crash_pic"
        Me.ShowIcon = False
        Me.ShowInTaskbar = False
        Me.Text = "crash_pic"
        Me.TopMost = True
        Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
        Me.pnl_holdtogether.ResumeLayout(False)
        CType(Me.pic_crash, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub
    Friend WithEvents pnl_holdtogether As System.Windows.Forms.Panel
    Friend WithEvents killme As System.Windows.Forms.Timer
    Friend WithEvents pic_crash As System.Windows.Forms.PictureBox
End Class


text:
<?php

namespace Phpatterns\Structural\Adapter;

interface WeatherInterface
{
    /**
     * Get the weather for a given city (temperature, humidity and pressure only).
     * @param string $city
     * @return Weather
     */
    public function getWeather($city);
}


text:
using System;
using System.Collections.Generic;
using System.Threading;
using GiTracker.Models;
using GiTracker.Services.Api;
using GiTracker.Services.Repos;
using GiTracker.Services.Rest;
using Moq;
using NUnit.Framework;

namespace GiTracker.Tests.Services
{
    [TestFixture]
    public class RepoServiceTests
    {
        [SetUp]
        public void Init()
        {
            var apiProviderMoq = new Mock<IGitApiProvider>();
            apiProviderMoq.Setup(moq => moq.GetUserRepositoriesRequest()).Returns(_repoRequest);
            _gitApiProvider = apiProviderMoq.Object;
        }

        private readonly IRestRequest _repoRequest = Mock.Of<IRestRequest>();
        private const string RestServiceExceptionMessage = "RestServiceExceptionMessage";
        private IGitApiProvider _gitApiProvider;

        [Test]
        public async void GetReposCallsIRestService()
        {
            // Arrange
            var repoList = new List<IRepo>();

            var restServiceMoq = new Mock<IRestService>();
            restServiceMoq.Setup(moq => moq.GetAsync(It.IsAny<IRestRequest>(), It.IsAny<CancellationToken>()))
                .ReturnsAsync(repoList);

            var repoService = new RepoService(restServiceMoq.Object, _gitApiProvider);

            // Act
            var repos = await repoService.GetReposAsync(CancellationToken.None);

            // Assert
            restServiceMoq.Verify(moq => moq.GetAsync(_repoRequest, It.IsAny<CancellationToken>()),
                Times.Once);

            Assert.AreEqual(repos, repoList);
        }

        [Test]
        [ExpectedException(typeof (Exception), ExpectedMessage = RestServiceExceptionMessage)]
        public async void GetReposDoesNotConsumeException()
        {
            // Arrange
            var restServiceMoq = new Mock<IRestService>();
            restServiceMoq.Setup(moq => moq.GetAsync(_repoRequest, It.IsAny<CancellationToken>()))
                .ThrowsAsync(new Exception(RestServiceExceptionMessage));

            var repoService = new RepoService(restServiceMoq.Object, _gitApiProvider);

            // Act
            await repoService.GetReposAsync(CancellationToken.None);

            // Assert
        }
    }
}


text:
/* @flow */
/* eslint fp/no-class:0 */

import React from 'react';
import { graphql } from 'react-relay';
import { compose, withPropsOnChange } from 'recompose';
import { withRouter } from 'react-router-dom';
import { parse } from 'query-string';
import {
  parseIntParam,
  parseFilterParam,
  parseJSONParam,
} from '@ncigdc/utils/uri';
import Query from '@ncigdc/modern_components/Query';

export default (Component: React.Class<*>) =>
  compose(
    withRouter,
    withPropsOnChange(
      ['location', 'defaultFilters'],
      ({ location, defaultFilters = null, defaultSize = 10 }) => {
        const q = parse(location.search);
        return {
          variables: {
            cases_offset: parseIntParam(q.cases_offset, 0),
            cases_size: parseIntParam(q.cases_size, 20),
            cases_sort: parseJSONParam(q.cases_sort, []),
            filters: parseFilterParam(q.filters, defaultFilters),
            score: 'annotations.annotation_id',
          },
        };
      },
    ),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        name="RepoCasesTable"
        minHeight={387}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query RepoCasesTable_relayQuery(
            $cases_size: Int
            $cases_offset: Int
            $cases_sort: [Sort]
            $filters: FiltersArgument
            $score: String
          ) {
            viewer {
              repository {
                cases {
                  hits(
                    score: $score
                    first: $cases_size
                    offset: $cases_offset
                    sort: $cases_sort
                    filters: $filters
                  ) {
                    total
                    edges {
                      node {
                        id
                        case_id
                        primary_site
                        disease_type
                        submitter_id
                        project {
                          project_id
                          program {
                            name
                          }
                        }
                        annotations {
                          hits(first: 1) {
                            total
                            edges {
                              node {
                                annotation_id
                              }
                            }
                          }
                        }
                        demographic {
                          gender
                          ethnicity
                          race
                          days_to_death
                          vital_status
                        }
                        diagnoses {
                          hits(first: 99) {
                            edges {
                              node {
                                primary_diagnosis
                                age_at_diagnosis
                              }
                            }
                          }
                        }
                        summary {
                          data_categories {
                            file_count
                            data_category
                          }
                          file_count
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });


text:
include $(srctree)/drivers/misc/mediatek/Makefile.custom

obj-y += ext_md_custom.o


text:
#include <simdmath/recipd2.h>

vector double
recipd2 (vector double x)
{
  return _recipd2(x);
}


text:
from __future__ import absolute_import
from schedule.models.calendars import *
from schedule.models.events import *
from schedule.models.rules import *

from schedule.signals import *


text:
using System;

namespace Arch.Data.DbEngine.MarkDown
{
    public class MarkUpMetrics
    {
        public String AllInOneKey { get; set; }

        public Int32 SuccessCount { get; set; }

        public Int32 Batches { get; set; }

        public Int32 MarkUpDelay { get; set; }

        public Boolean Success { get; set; }
    }
}


text:
# JAIL.js - Just-Another-Interesting-Library

[![Build Status](https://travis-ci.org/DizWARE/jail-js.svg?branch=master)](https://travis-ci.org/DizWARE/jail-js)
[![npm version](https://badge.fury.io/js/jail-js.svg)](https://badge.fury.io/js/jail-js)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Table of Contents

1. [Intro to Library](#intro-to-library)
    1. [Example](#example)
        1. [Without the Library](#without-the-library)
        1. [With the Library](#with-the-library)
    1. [The Pieces](#the-pieces)
        1. [Decorators](./decorators/index.md)
            1. [Class Decorators](./decorators/index.md#class-decorators)
            1. [Property Decorators](./decorators/index.md#property-decorators)
            1. [Method Decorators](./decorators/index.md#method-decorators)
        1. [Enumerations](./enumerations/index.md)
        1. [Interfaces](./interfaces/index.md)
            1. [Data Interfaces](./interfaces/index.md#data-interfaces)
            1. [Component Interfaces](./interfaces/index.md#component-interfaces)
        1. [Typeguards](./typeguards/index.md)
    1. [Getting Started](#getting-started)
        1. [Consume Library](#consume-library)
        1. [Build Components](#build-components)
            1. [Create your Main HTML](#create-your-main-html)
            1. [Create your HTML Template](#create-your-html-template)
            1. [Create your Stylesheet](#create-your-stylesheet)
            1. [Create your Javascript](#create-your-javascript)

## Intro to Library

This library provides developers an abstraction from the work required to create and use native web components. It is built with Typescript, and targets the V1 spec of Web Components and Shadow DOM. It also utilizes features from HTML Imports and the Template tag, providing a full native suite of features.

Instead of trying to explain too much of why, I'll provide some examples of using the web components without the library vs using this library. This is a very limited view. You have to think of using these in more realistic projects with tens to hundreds of different components.

Please Note - This was written back when TS Mixins were expressed using decorators. Since TS has added actual mixins, the library needs to be updated to fit these changes. I've currently locked the version of TS to a version that the library was built on for now, so it will build and run.

### Example

#### Without the Library

* **index.html**

```HTML
<html>
<head>
    <link rel="import" href="./basic-element.html" />
</head>
<body>
    <basic-element>
        <div>Hello World</div>
    </basic-element>
</body>
</html>
```

* **basic-element.html**

```HTML
<template id="basicElement">
  <style>
    p { color: orange; }
  </style>
  <p>Cool, I'm in Shadow DOM. My markup was stamped from a <template>.</p>
  <input type="text" id="basicInput">
</template>

<script src="./script"></script>
```

* **basic-element.ts**

```Typescript

class BasicElement extends HTMLElement {

    /**
     * Property for the input child.
     */
    private _input: HTMLInputElement;

    constructor() {
        super();

        let ownerDocument = (document.currentScript || document._currentScript).ownerDocument;
        let t = ownerDocument.querySelector('#basicElement');
        let clone = t.content.cloneNode(true);

        // Create a shadow DOM
        let shadowRoot = this.attachShadow({mode: 'open'});
        shadowRoot.appendChild(clone);

        this._input = shadowRoot.querySelector("#basicInput");

        // Set an initial state for the component attributes.
        this.setAttribute("attr1", 0);
        this.setAttribute("attr2", true);
    }

    /**
     * List all the attributes that should be watched.
     */
    static observedAttributes() {
        return [ "my-attr1", "my-attr2" ]
    }

    connectedCallback() {
        // Bring in all the DOM children into the shadow DOM, so they get displayed.
        for (let child of this.children) {
            shadowRoot.appendChild(child);
        }
    }

    attributeChangedCallback(attrName, oldValue, newValue) {
        switch(attrName) {
            case "my-attr1":
                this.onAttr1Changed(oldValue, newValue);
                break;
            case "my-attr2":
                this.onAttr2Changed(oldValue, newValue);
                break;
        }
    }

    onAttr1Changed(oldValue: number, newValue: number) {
        let attr2 = this.getAttribute("my-attr2");

        if (attr2) {
            console.log(`Hello, the number value changed from ${oldValue} to ${newValue}`)
        }
    }

    onAttr2Changed(oldValue: boolean, newValue: boolean) {
        if (newValue) {
            console.log(`Hello, your current value is ${this._input.value}`)
        }
    }
}

document.registerElement('basic-element', BasicElement);
```

Couple things to note with not using the library

* No css is being used here because its actually a very complex problem to link css from a file in HTML imports. The relative path of the imports will be whatever the hosting HTML file is, not the HTML file that is being imported. The `<style>` tag is used instead
* Without using the web-components polyfill or writing something yourself, a race condition will be created where a parent component is finished loading and is beginning to do some of its functionality and a child component hasn't loaded yet; Unexpected behavior will occur if you try to use the child that hasn't loaded.

#### With the Library

* **index.html**

```HTML
<html>
<body>
    <basic-element>
        <div>Hello World</div>
    </basic-element>
</body>

<!--The classes of all the components in your application need to be loaded.-->
<!--This part could easily be one line if you already are using index module exports.-->
<script src="./basic-element"></script>
</html>
```

* **basic-element.css**

```CSS
p {
    color: orange;
}
```

* **basic-element.html**

```HTML
<template>
  <p>Cool, I'm in Shadow DOM. My markup was stamped from a <template>.</p>
  <input type="text" id="basicInput">
</template>
```

* **basic-element.ts**

```Typescript
import { Component, Attributes, Attribute, AttributeChangedListener } from "jail-js/decorators";

/**__dirname isn't available for projects that aren't node based. See web example for how to deal with getting file locations.**/
@Component({
    tagName: "basic-element",
    templateUrl: `${__dirname}/basic-element.html`,
    styleUrl: `${__dirname}/basic-element.css`
})
@Attributes([
    { name: "my-attr1"},
    { name: "my-attr2", value: true }
])
class BasicElement extends HTMLElement {

    /**
     * Property for the input child.
     */
    @QuerySelector("#basicInput") private _input: HTMLInputElement;

    @Attribute private myAttr1 = 0; // This value could have also been set using the @Attributes decorator by adding a value to the attribute info.
    @Attribute private myAttr2;

    @AttributeChangedListener("my-attr1")
    onAttr1Changed(oldValue: number, newValue: number) {
        if (this.myAttr2) {
            console.log(`Hello, the number value changed from ${oldValue} to ${newValue}`)
        }
    }

    @AttributeChangedListener("my-attr2")
    onAttr2Changed(oldValue: boolean, newValue: boolean) {
        if (newValue) {
            console.log(`Hello, your current value is ${this._input.value}`)
        }
    }
}
```

## The Pieces

* [View Docs for all the Decorators](./decorators/index.md)

* [View Docs for all the Interfaces](./interfaces/index.md)

* [View Docs for all the Enumerations](./enumerations/index.md)

* [View Docs for all the Typeguards](./typeguards/index.md)

## Getting Started

A more detailed guide can be found [here](./tutorial/index.md)

To start building your own application using the library start by NPM installing:

```CMD
npm install --save jail-js
```

No other steps need to be made to start using the library.

### Consume Library

To consume the library in your JavaScript/Typescript:

```Typescript
import { [decorators to import] } from "jail-js/decorators";
import { [interfaces to import] } from "jail-js/interfaces";
import { [typeguards to import] } from "jail-js/typeguards";
import { [enumerations to import] } from "jail-js/enumerations";
```

### Build Components

#### Create your main HTML

* **index.html**

```HTML
<html>
<body>
    <my-element></my-element>
    <script src="./my-element.js"></script>
</body>
</html>
```

#### Create your HTML template

* **my-element.html**

```HTML
<template>
    <div id="child"></div>
</template>
```

#### Create your stylesheet

* **my-element.css**

```CSS
#child {
    color: red;
}
```

#### Create your Javascript

First import the pieces you need from the library, write your code, and prosper.

* **my-element.ts**

```Typescript
import { Component, Attribute, QuerySelector, Attributes, AttributeChangedListener } from "jail-js/decorators";
import { IOnConnected } from "jail-js/interfaces";

@Component({
    tagName: "my-element",
    templateURL: "path/to/my-element.html",
    styleURL: "path/to/my-element.css" // or ["path/to/style1.css", "path/to/style2.css"]
})
@Attributes([
    { name: "first-attribute" },
    { name: "second-attribute", value: 0 }
])
export class MyElement extends HTMLElement implements IOnConnected {
    /**
     * Reads and writes the `first-attribute` attribute to the DOM.
     */
    @Attribute public firstAttribute: boolean = true;

    /**
     * Reads and writes the `second-attribute` attribute to the DOM.
     */
    @Attribute private secondAttribute: number;

    /**
     * Reads the child with the #child selector from the DOM.
     */
    @QuerySelector("#child") private _child;

    /**
     * If you add a constructor, you must always call super() as the first line.
     */
    constructor() {
        super();

        // Bind the handler to this event.
        this.onChildClicked = this.onChildClicked.bind(this);
    }

    /**
     * Hook up the child clicked event.
     */
    onConnected() {
        this._child.addEventListener("click", this.onChildClicked)
    }

    /**
     * Increment the attribute when the child is clicked.
     */
    onChildClicked() {
        this.secondAttribute++;
    }

    /**
     * Log when first-attribute is changed.
     */
    @AttributeChangedListener("first-attribute")
    onFirstAttributeChanged(oldValue, newValue) {
        console.log("first-attribute was changed");
    }

    /**
     * Log when second-attribute is changed.
     */
    @AttributeChangedListener("second-attribute")
    onSecondAttributeChanged(oldValue, newValue) {
        console.log("second-attribute was changed");
    }
}


text:
package com.example.ericliu.playconcurrent.listcontent;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.ericliu.playconcurrent.semaphore.SemaphoreFragment;
import com.example.ericliu.playconcurrent.R;

import java.util.List;

/**
 * An activity representing a list of Items. This activity
 * has different presentations for handset and tablet-size devices. On
 * handsets, the activity presents a list of items, which when touched,
 * lead to a {@link ItemDetailsActivity} representing
 * item activity. On tablets, the activity presents the list of items and
 * item activity side-by-side using two vertical panes.
 */
public class ItemListActivity extends AppCompatActivity {

    /**
     * Whether or not the activity is in two-pane mode, i.e. running on a tablet
     * device.
     */
    private boolean mTwoPane;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_item_list);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });

        View recyclerView = findViewById(R.id.item_list);
        assert recyclerView != null;
        setupRecyclerView((RecyclerView) recyclerView);

        if (findViewById(R.id.item_detail_container) != null) {
            // The detail container view will be present only in the
            // large-screen layouts (res/values-w900dp).
            // If this view is present, then the
            // activity should be in two-pane mode.
            mTwoPane = true;
        }
    }

    private void setupRecyclerView(@NonNull RecyclerView recyclerView) {
        recyclerView.setAdapter(new SimpleItemRecyclerViewAdapter(ListContent.ITEMS));
    }

    public class SimpleItemRecyclerViewAdapter
            extends RecyclerView.Adapter<SimpleItemRecyclerViewAdapter.ViewHolder> {

        private final List<ListItem> mValues;

        public SimpleItemRecyclerViewAdapter(List<ListItem> items) {
            mValues = items;
        }

        @Override
        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.item_list_content, parent, false);
            return new ViewHolder(view);
        }

        @Override
        public void onBindViewHolder(final ViewHolder holder, final int position) {
            holder.mItem = mValues.get(position);
            holder.mContentView.setText(mValues.get(position).content);

            holder.mView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    if (mTwoPane) {
                        Bundle arguments = new Bundle();
                        Fragment fragment = new FragmentFactory().createFragment(mValues.get(position));
                        fragment.setArguments(arguments);
                        getFragmentManager().beginTransaction()
                                .replace(R.id.item_detail_container, fragment)
                                .commit();
                    } else {
                        Context context = v.getContext();
                        Intent intent = new Intent(context, ItemDetailsActivity.class);
                        intent.putExtra(ItemDetailsActivity.ARG_ITEM, mValues.get(position));

                        context.startActivity(intent);
                    }
                }
            });
        }

        @Override
        public int getItemCount() {
            return mValues.size();
        }

        public class ViewHolder extends RecyclerView.ViewHolder {
            public final View mView;
            public final TextView mIdView;
            public final TextView mContentView;
            public ListItem mItem;

            public ViewHolder(View view) {
                super(view);
                mView = view;
                mIdView = (TextView) view.findViewById(R.id.id);
                mContentView = (TextView) view.findViewById(R.id.content);
            }

            @Override
            public String toString() {
                return super.toString() + " '" + mContentView.getText() + "'";
            }
        }
    }
}


text:
package com.googlecode.dex2jar.tools.to;

public class Do {

    /**
     * @param args
     */
    public static void main(String[] args) {
        System.out.println("This is not support!");
    }

}


text:
package janala.logger.inst;

public class IF_ICMPNE extends Instruction {
  int label;

  public IF_ICMPNE(int iid, int mid, int label) {
    super(iid, mid);
    this.label = label;
  }

  public void visit(IVisitor visitor) {
    visitor.visitIF_ICMPNE(this);
  }

  @Override
  public String toString() {
    return "IF_ICMPNE iid=" + iid + " mid=" + mid + " label=" + label;
  }
}


text:
DDZ_ROOM_LAYER_CLASS = class("DDZ_ROOM_LAYER_CLASS", function()
    return display.newScene("DDZ_ROOM_LAYER_CLASS")
end)

function DDZ_ROOM_LAYER_CLASS:ctor()
    self:enableNodeEvents()
    self.uid = new_cookie()
    self:onInit()
end

function DDZ_ROOM_LAYER_CLASS:onInit()
    display.newSprite("HelloWorld.png")
        :move(display.center)
        :addTo(self)

    cc.Label:createWithSystemFont("Ddz Room Layer", "Arial", 40)
        :move(display.cx, display.cy + 200)
        :addTo(self)

    local function touchEvent(sender,eventType)
        if eventType == ccui.TouchEventType.ended then
            ME_D.request_message(CMD_ROOM_MESSAGE, "enter_desk", {})
        end
    end

    local textButton = ccui.Button:create()
    textButton:setTouchEnabled(true)
    textButton:setScale9Enabled(true)
    textButton:loadTextures("button.png", "buttonHighlighted.png", "")
    textButton:setContentSize(cc.size(180, textButton:getVirtualRendererSize().height * 1.5))
    textButton:setTitleText("开始游戏")
    textButton:setPosition(cc.p(500,100))
    textButton:addTouchEventListener(touchEvent)
    self:addChild(textButton)
end

function DDZ_ROOM_LAYER_CLASS:enter_desk()
    trace("DDZ_ROOM_LAYER_CLASS:enter_desk")
end

function DDZ_ROOM_LAYER_CLASS:onCleanup_()

end

function DDZ_ROOM_LAYER_CLASS:onEnter_()
    register_as_audience(self.uid, {EVENT_ENTER_DESK={func = self.enter_desk, args = {self} }})
end

function DDZ_ROOM_LAYER_CLASS:onExit_()
    remove_audience_from_raiser(self.uid)
end


text:
<?php

final class PhabricatorMacroQuery
  extends PhabricatorCursorPagedPolicyAwareQuery {

  private $ids;
  private $phids;
  private $authorPHIDs;
  private $names;
  private $nameLike;
  private $namePrefix;
  private $dateCreatedAfter;
  private $dateCreatedBefore;
  private $flagColor;

  private $needFiles;

  private $status = 'status-any';
  const STATUS_ANY = 'status-any';
  const STATUS_ACTIVE = 'status-active';
  const STATUS_DISABLED = 'status-disabled';

  public static function getStatusOptions() {
    return array(
      self::STATUS_ACTIVE   => pht('Active Macros'),
      self::STATUS_DISABLED => pht('Disabled Macros'),
      self::STATUS_ANY      => pht('Active and Disabled Macros'),
    );
  }

  public static function getFlagColorsOptions() {
    $options = array(
      '-1' => pht('(No Filtering)'),
      '-2' => pht('(Marked With Any Flag)'),
    );

    foreach (PhabricatorFlagColor::getColorNameMap() as $color => $name) {
      $options[$color] = $name;
    }

    return $options;
  }

  public function withIDs(array $ids) {
    $this->ids = $ids;
    return $this;
  }

  public function withPHIDs(array $phids) {
    $this->phids = $phids;
    return $this;
  }

  public function withAuthorPHIDs(array $author_phids) {
    $this->authorPHIDs = $author_phids;
    return $this;
  }

  public function withNameLike($name) {
    $this->nameLike = $name;
    return $this;
  }

  public function withNames(array $names) {
    $this->names = $names;
    return $this;
  }

  public function withNamePrefix($prefix) {
    $this->namePrefix = $prefix;
    return $this;
  }

  public function withStatus($status) {
    $this->status = $status;
    return $this;
  }

  public function withDateCreatedBefore($date_created_before) {
    $this->dateCreatedBefore = $date_created_before;
    return $this;
  }

  public function withDateCreatedAfter($date_created_after) {
    $this->dateCreatedAfter = $date_created_after;
    return $this;
  }

  public function withFlagColor($flag_color) {
    $this->flagColor = $flag_color;
    return $this;
  }

  public function needFiles($need_files) {
    $this->needFiles = $need_files;
    return $this;
  }

  public function newResultObject() {
    return new PhabricatorFileImageMacro();
  }

  protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
    $where = parent::buildWhereClauseParts($conn);

    if ($this->ids !== null) {
      $where[] = qsprintf(
        $conn,
        'm.id IN (%Ld)',
        $this->ids);
    }

    if ($this->phids !== null) {
      $where[] = qsprintf(
        $conn,
        'm.phid IN (%Ls)',
        $this->phids);
    }

    if ($this->authorPHIDs !== null) {
      $where[] = qsprintf(
        $conn,
        'm.authorPHID IN (%Ls)',
        $this->authorPHIDs);
    }

    if (($this->nameLike !== null) && strlen($this->nameLike)) {
      $where[] = qsprintf(
        $conn,
        'm.name LIKE %~',
        $this->nameLike);
    }

    if ($this->names !== null) {
      $where[] = qsprintf(
        $conn,
        'm.name IN (%Ls)',
        $this->names);
    }

    if (($this->namePrefix !== null) && strlen($this->namePrefix)) {
      $where[] = qsprintf(
        $conn,
        'm.name LIKE %>',
        $this->namePrefix);
    }

    switch ($this->status) {
      case self::STATUS_ACTIVE:
        $where[] = qsprintf(
          $conn,
          'm.isDisabled = 0');
        break;
      case self::STATUS_DISABLED:
        $where[] = qsprintf(
          $conn,
          'm.isDisabled = 1');
        break;
      case self::STATUS_ANY:
        break;
      default:
        throw new Exception(pht("Unknown status '%s'!", $this->status));
    }

    if ($this->dateCreatedAfter) {
      $where[] = qsprintf(
        $conn,
        'm.dateCreated >= %d',
        $this->dateCreatedAfter);
    }

    if ($this->dateCreatedBefore) {
      $where[] = qsprintf(
        $conn,
        'm.dateCreated <= %d',
        $this->dateCreatedBefore);
    }

    if ($this->flagColor != '-1' && $this->flagColor !== null) {
      if ($this->flagColor == '-2') {
        $flag_colors = array_keys(PhabricatorFlagColor::getColorNameMap());
      } else {
        $flag_colors = array($this->flagColor);
      }
      $flags = id(new PhabricatorFlagQuery())
        ->withOwnerPHIDs(array($this->getViewer()->getPHID()))
        ->withTypes(array(PhabricatorMacroMacroPHIDType::TYPECONST))
        ->withColors($flag_colors)
        ->setViewer($this->getViewer())
        ->execute();

      if (empty($flags)) {
        throw new PhabricatorEmptyQueryException(pht('No matching flags.'));
      } else {
        $where[] = qsprintf(
          $conn,
          'm.phid IN (%Ls)',
          mpull($flags, 'getObjectPHID'));
      }
    }

    return $where;
  }

  protected function didFilterPage(array $macros) {
    if ($this->needFiles) {
      $file_phids = mpull($macros, 'getFilePHID');
      $files = id(new PhabricatorFileQuery())
        ->setViewer($this->getViewer())
        ->setParentQuery($this)
        ->withPHIDs($file_phids)
        ->execute();
      $files = mpull($files, null, 'getPHID');

      foreach ($macros as $key => $macro) {
        $file = idx($files, $macro->getFilePHID());
        if (!$file) {
          unset($macros[$key]);
          continue;
        }
        $macro->attachFile($file);
      }
    }

    return $macros;
  }

  protected function getPrimaryTableAlias() {
    return 'm';
  }

  public function getQueryApplicationClass() {
    return 'PhabricatorMacroApplication';
  }

  public function getOrderableColumns() {
    return parent::getOrderableColumns() + array(
      'name' => array(
        'table' => 'm',
        'column' => 'name',
        'type' => 'string',
        'reverse' => true,
        'unique' => true,
      ),
    );
  }

  protected function newPagingMapFromPartialObject($object) {
    return array(
      'id' => (int)$object->getID(),
      'name' => $object->getName(),
    );
  }

  public function getBuiltinOrders() {
    return array(
      'name' => array(
        'vector' => array('name'),
        'name' => pht('Name'),
      ),
    ) + parent::getBuiltinOrders();
  }

}


text:
<?php foreach ($groups as $group => $status): ?>
 * <?php echo $group ?> <?php echo (($status !== NULL) ? ($status['timestamp'].' '.(( ! empty($status['description'])) ? ('('.$status['description'].')') : '')) : 'Not installed'); ?>

<?php endforeach; ?>


text:
<?php

namespace BEE\BackOffice\BeeeaseBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

use BEE\Services\BeeeaseBundle\Entity\Transvasement;
use BEE\BackOffice\BeeeaseBundle\Form\TransvasementType;

/**
 * Transvasement controller.
 *
 * @Route("/transvasement")
 */
class TransvasementController extends Controller
{

    /**
     * Lists all Transvasement entities.
     *
     * @Route("/", name="transvasement")
     * @Method("GET")
     * @Template()
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('BEEServicesBeeeaseBundle:Transvasement')->findAll();

        return array(
            'entities' => $entities,
        );
    }
    /**
     * Creates a new Transvasement entity.
     *
     * @Route("/", name="transvasement_create")
     * @Method("POST")
     * @Template("BEEServicesBeeeaseBundle:Transvasement:new.html.twig")
     */
    public function createAction(Request $request)
    {
        $entity = new Transvasement();
        $form = $this->createCreateForm($entity);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('transvasement'));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
    * Creates a form to create a Transvasement entity.
    *
    * @param Transvasement $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createCreateForm(Transvasement $entity)
    {
        $form = $this->createForm(new TransvasementType(), $entity, array(
            'action' => $this->generateUrl('transvasement'),
            'method' => 'POST',
        ));

        $form->add('submit', 'submit', array('label' => 'Enregistrer','attr' => array('class' => 'btn btn-default')));

        return $form;
    }

    /**
     * Displays a form to create a new Transvasement entity.
     *
     * @Route("/new", name="transvasement_new")
     * @Method("GET")
     * @Template()
     */
    public function newAction()
    {
        $entity = new Transvasement();
        $form   = $this->createCreateForm($entity);

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }

    /**
     * Finds and displays a Transvasement entity.
     *
     * @Route("/{id}", name="transvasement_show")
     * @Method("GET")
     * @Template()
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BEEServicesBeeeaseBundle:Transvasement')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Transvasement entity.');
        }

        return array(
            'entity'      => $entity,
        );
    }

    /**
     * Displays a form to edit an existing Transvasement entity.
     *
     * @Route("/{id}/edit", name="transvasement_edit")
     * @Method("GET")
     * @Template()
     */
    public function editAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BEEServicesBeeeaseBundle:Transvasement')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Transvasement entity.');
        }

        $editForm = $this->createEditForm($entity);

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
        );
    }

    /**
    * Creates a form to edit a Transvasement entity.
    *
    * @param Transvasement $entity The entity
    *
    * @return \Symfony\Component\Form\Form The form
    */
    private function createEditForm(Transvasement $entity)
    {
        $form = $this->createForm(new TransvasementType(), $entity, array(
            'action' => $this->generateUrl('transvasement_update', array('id' => $entity->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Modifier','attr' => array('class' => 'btn btn-default')));

        return $form;
    }
    /**
     * Edits an existing Transvasement entity.
     *
     * @Route("/{id}", name="transvasement_update")
     * @Method("PUT")
     * @Template("BEEServicesBeeeaseBundle:Transvasement:edit.html.twig")
     */
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('BEEServicesBeeeaseBundle:Transvasement')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Transvasement entity.');
        }

        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            return $this->redirect($this->generateUrl('transvasement'));
        }

        return array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
        );
    }
    /**
     * Deletes a Transvasement entity.
     *
     * @Route("/delete/{id}", name="transvasement_delete")
     *
     */
    public function deleteAction($id)
    {

            $em = $this->getDoctrine()->getManager();
            $entity = $em->getRepository('BEEServicesBeeeaseBundle:Transvasement')->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Transvasement entity.');
            }

            $em->remove($entity);
            $em->flush();

        return $this->redirect($this->generateUrl('transvasement'));
    }

}


text:
<?php
use Df\Core\Helper\Text as T;
/**
 * 2015-12-31
 * 1) IntelliJ IDEA этого не показывает, но пробел здесь не обычный, а узкий: https://en.wikipedia.org/wiki/Thin_space
 * 2) Глобальные константы появились в PHP 5.3:
 * http://www.codingforums.com/php/303927-unexpected-t_const-php-version-5-2-17-a.html
 * @used-by \Dfe\CurrencyFormat\O::options()
 * @used-by \Dfe\CurrencyFormat\O::thousandsSeparator()
 */
const DF_THIN_SPACE = ' ';

/**
 * @see df_bts_yn()
 * @used-by \Df\Qa\Dumper::dump()
 * @used-by \Dfe\AlphaCommerceHub\Method::charge()
 * @used-by \Dfe\Vantiv\Charge::pCharge()
 * @used-by \Inkifi\Pwinty\T\CaseT\V30\Order\Validate::t02()
 */
function df_bts(bool $v):string {return $v ? 'true' : 'false';}

/**
 * 2017-11-08
 * @used-by \Dfe\Stripe\Init\Action::redirectUrl()
 * @used-by \Inkifi\Pwinty\Controller\Index\Index::execute()
 * @see df_bts()
 */
function df_bts_yn(bool $v):string {return $v ? 'yes' : 'no';}

/**
 * Я так понимаю, здесь безопасно использовать @uses strpos вместо @see mb_strpos() даже для UTF-8.
 * http://stackoverflow.com/questions/13913411/mb-strpos-vs-strpos-whats-the-difference
 * 2015-04-17 Добавлена возможность указывать в качестве $needle массив.
 * 2022-10-14 @see str_contains() has been added to PHP 8: https://www.php.net/manual/function.str-contains.php
 * 2022-11-26 We can not declare the argument as `string ...$n` because such a syntax will reject arrays: https://3v4l.org/jFdPm
 * @used-by df_block_output()
 * @used-by df_is_bin_magento()
 * @used-by df_request_ua()
 * @used-by df_rp_has()
 * @used-by ikf_ite()
 * @used-by mnr_recurring_is()
 * @used-by \Alignet\Paymecheckout\Plugin\Magento\Framework\Session\SidResolver::aroundGetSid() (innomuebles.com, https://github.com/innomuebles/m2/issues/11)
 * @used-by \CanadaSatellite\Bambora\Facade::api() (canadasatellite.ca, https://github.com/canadasatellite-ca/bambora/issues/1)
 * @used-by \CanadaSatellite\Core\Plugin\Mageplaza\Blog\Helper\Data::afterGetBlogUrl() (canadasatellite.ca, https://github.com/canadasatellite-ca/site/issues/43)
 * @used-by \Df\Cron\Model\LoggerHandler::p()
 * @used-by \Df\Sentry\Trace::get_frame_context()
 * @used-by \Df\Xml\X::k()
 * @used-by \Dfe\CurrencyFormat\Plugin\Catalog\Controller\Adminhtml\Product\Initialization\Helper\AttributeFilter::parse()
 * @used-by \DxMoto\Core\Observer\CanLog::execute()
 * @used-by \RWCandy\Captcha\Assert::name()
 * @used-by \TFC\Core\Observer\CanLog::execute()
 * @param string|string[] $n
 */
function df_contains(string $haystack, ...$n):bool {/** @var bool $r */
	# 2017-07-10 This branch is exclusively for optimization.
	# 2022-11-26 The previous (also correct) condition was: `1 === count($n) && !is_array($n0 = $n[0])`
	if (!is_array($n0 = df_arg($n))) {
		$r = false !== strpos($haystack, $n0);
	}
	else {
		$r = false;
		$n = dfa_flatten($n);
		foreach ($n as $nItem) {/** @var string $nItem */
			if (false !== strpos($haystack, $nItem)) {
				$r = true;
				break;
			}
		}
	}
	return $r;
}

/**
 * 2015-08-24
 * 2022-10-31 @deprecated It is unused.
 */
function df_contains_ci(string $haystack, string $n):bool {return df_contains(mb_strtoupper($haystack), mb_strtoupper($n));}

/**
 * Иногда я для разработки использую заплатку ядра для xDebug —
 * отключаю set_error_handler для режима разработчика.
 *
 * Так вот, xDebug при обработке фатальных сбоев (в том числе и E_RECOVERABLE_ERROR),
 * выводит на экран диагностическое сообщение, и после этого останавливает работу интерпретатора.
 *
 * Конечно, если у нас сбой типов E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING,
 * E_COMPILE_ERROR, E_COMPILE_WARNING, то и set_error_handler не поможет
 * (не обрабатывает эти типы сбоев, согласно официальной документации PHP).
 *
 * Однако сбои типа E_RECOVERABLE_ERROR обработик сбоев Magento,
 * установленный посредством set_error_handler, переводит в исключительние ситуации.
 *
 * xDebug же при E_RECOVERABLE_ERROR останавивает работу интерпретатора, что нехорошо.
 *
 * Поэтому для функций, которые могут привести к E_RECOVERABLE_ERROR,
 * пишем обёртки, которые вместо E_RECOVERABLE_ERROR возбуждают исключительную ситуацию.
 * Одна из таких функций — df_string.
 *
 * @used-by df_type()
 * @used-by \Df\Xml\X::importString()
 * @param mixed $v
 */
function df_string($v):string {
	if (is_object($v)) {
		/**
		 * К сожалению, нельзя здесь для проверки публичности метода использовать @see is_callable(),
		 * потому что наличие @see \Magento\Framework\DataObject::__call()
		 * приводит к тому, что @see is_callable всегда возвращает true.
		 * Обратите внимание, что @uses method_exists(), в отличие от @see is_callable(),
		 * не гарантирует публичную доступность метода:
		 * т.е. метод может у класса быть, но вызывать его всё равно извне класса нельзя,
		 * потому что он имеет доступность private или protected.
		 * Пока эта проблема никак не решена.
		 */
		if (!method_exists($v, '__toString')) {
			df_error('The developer wrongly treats an object of the class %s as a string.', get_class($v));
		}
	}
	elseif (is_array($v)) {
		df_error('The developer wrongly treats an array as a string.');
	}
	return strval($v);
}

/**
 * @used-by \Df\Zf\Validate\Type::_message()
 * @param mixed $v
 */
function df_string_debug($v):string {
	$r = ''; /** @var string $r */
	if (is_object($v)) {
		/**
		 * К сожалению, нельзя здесь для проверки публичности метода использовать @see is_callable(),
		 * потому что наличие @see \Magento\Framework\DataObject::__call()
		 * приводит к тому, что @see is_callable всегда возвращает true.
		 * Обратите внимание, что @uses method_exists(), в отличие от @see is_callable(),
		 * не гарантирует публичную доступность метода:
		 * т.е. метод может у класса быть, но вызывать его всё равно извне класса нельзя,
		 * потому что он имеет доступность private или protected.
		 * Пока эта проблема никак не решена.
		 */
		if (!method_exists($v, '__toString')) {
			$r = get_class($v);
		}
	}
	elseif (is_array($v)) {
		$r = sprintf('<an array of %d elements>', count($v));
	}
	elseif (is_bool($v)) {
		$r = $v ? 'logical <yes>' : 'logical <no>';
	}
	else {
		$r = strval($v);
	}
	return $r;
}

/**
 * https://php.net/manual/function.str-split.php#107658
 * 2022-10-31 @deprecated It is unused.
 * @return string[]
 */
function df_string_split(string $s):array {return preg_split("//u", $s, -1, PREG_SPLIT_NO_EMPTY);}

/** @used-by \Df\PaypalClone\W\Event::validate() */
function df_strings_are_equal_ci(string $s1, string $s2):bool {return 0 === strcmp(mb_strtolower($s1), mb_strtolower($s2));}

/**
 * @used-by df_extend()
 * @used-by df_quote_double()
 * @used-by df_quote_russian()
 * @used-by df_quote_single()
 * @used-by \Df\Core\Text\Regex::isSubjectMultiline()
 */
function df_t():T {return T::s();}

/**
 * 2016-07-05 $length - это длина уникальной части, без учёта $prefix.
 * @used-by \Df\Core\Test\lib\DbColumn::df_db_column_add_drop()
 * @used-by \Df\Core\Test\lib\DbColumn::df_db_column_add_drop_2()
 * @used-by \Df\Core\Test\lib\DbColumn::df_db_column_rename()
 * @used-by \Df\Core\Test\lib\DbColumn::df_db_column_rename()
 * @used-by \Df\Framework\Form\Element\Multiselect::getElementHtml()
 * @used-by \Df\Sso\Button::attributes()
 * @used-by \Dfe\Moip\P\Reg::p()
 * @used-by \Dfe\Moip\Test\CaseT\Customer::pCustomer()
 * @used-by \Dfe\Moip\Test\CaseT\Notification::create()
 * @used-by \Dfe\Moip\Test\Order::pOrder()
 * @used-by \Dfe\Omise\Test\Customer::tRetrieveNonExistent()
 * @used-by \Dfe\SecurePay\Refund::process()
 * @used-by \Dfe\Sift\Session::get()
 * @used-by \Dfe\TBCBank\Charge::pCharge()
 * @used-by \Dfe\TBCBank\Test\CaseT\Regular::transId()
 * @used-by \Dfe\Vantiv\Test\CaseT\Charge::req()
 * @used-by \Inkifi\Pwinty\T\CaseT\V30\Order\AddImage::t01()
 * @used-by \Inkifi\Pwinty\T\CaseT\V30\Order\AddImage::t02()
 */
function df_uid(int $length = 0, string $prefix = ''):string {
	# Важно использовать $more_entropy = true, потому что иначе на быстрых серверах
	# (я заметил такое поведение при использовании Zend Server Enterprise и PHP 5.4)
	# uniqid будет иногда возвращать одинаковые значения при некоторых двух последовательных вызовах.
	# 2016-07-05
	# При параметре $more_entropy = true значение будет содержать точку,
	# например: «4b340550242239.64159797».
	# Решил сегодня удалять эту точку из-за платёжной системы allPay,
	# которая требует, чтобы идентификаторы содержали только цифры и латинские буквы.
	$r = str_replace('.', '', uniqid($prefix, $more_entropy = true)); /** @var string $r */
	# Уникальным является именно окончание uniqid, а не начало.
	# Два последовательных вызова uniqid могу вернуть:
	# 5233061890334
	# 52330618915dd
	# Начало у этих значений — одинаковое, а вот окончание — различное.
	return $prefix . (!$length ? $r : substr($r, -$length));
}


text:
<?php
class Kwf_Model_Union_Dependent_TestModel extends Kwf_Model_Union
{
    protected $_columnMapping = 'Kwf_Model_Union_Dependent_TestMapping';
    protected $_models = array(
        '1m' => 'Kwf_Model_Union_Dependent_Model1',
        '2m' => 'Kwf_Model_Union_Dependent_Model2',
    );

    protected function _init()
    {
        $this->_referenceMap['Parent'] = 'parent_id->Kwf_Model_Union_Dependent_Parent';
        parent::_init();
    }
}


text:
#include "OgreD3D11Device.h"

namespace Ogre
{
	//---------------------------------------------------------------------
	D3D11Device::eExceptionsErrorLevel D3D11Device::mExceptionsErrorLevel = D3D11Device::D3D_NO_EXCEPTION;
	//---------------------------------------------------------------------
	D3D11Device::D3D11Device( ID3D11DeviceN * D3D11device )
		: mD3D11Device(D3D11device)
		, mImmediateContext(0)
		, mInfoQueue(NULL)
		, mClassLinkage(0)
	{
        if (D3D11device)
        {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
		    D3D11device->GetImmediateContext(&mImmediateContext);
#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
		    D3D11device->GetImmediateContext1(&mImmediateContext);
#endif
            HRESULT hr = mD3D11Device->QueryInterface(__uuidof(ID3D11InfoQueue), (LPVOID*)&mInfoQueue);

		    if (SUCCEEDED(hr))
		    {
			    mInfoQueue->ClearStoredMessages();
			    mInfoQueue->ClearRetrievalFilter();
			    mInfoQueue->ClearStorageFilter();

			    D3D11_INFO_QUEUE_FILTER filter;
			    ZeroMemory(&filter, sizeof(D3D11_INFO_QUEUE_FILTER));
			    std::vector<D3D11_MESSAGE_SEVERITY> severityList;

			    switch(mExceptionsErrorLevel)
			    {
			    case D3D_NO_EXCEPTION:
				    severityList.push_back(D3D11_MESSAGE_SEVERITY_CORRUPTION);
			    case D3D_CORRUPTION:
				    severityList.push_back(D3D11_MESSAGE_SEVERITY_ERROR);
			    case D3D_ERROR:
				    severityList.push_back(D3D11_MESSAGE_SEVERITY_WARNING);
			    case D3D_WARNING:
			    case D3D_INFO:
				    severityList.push_back(D3D11_MESSAGE_SEVERITY_INFO);
			    default:
				    break;
			    }

			    if (severityList.size() > 0)
			    {
				    filter.DenyList.NumSeverities = severityList.size();
				    filter.DenyList.pSeverityList = &severityList[0];
			    }

			    mInfoQueue->AddStorageFilterEntries(&filter);
			    mInfoQueue->AddRetrievalFilterEntries(&filter);
		    }

			// If feature level is 11, create class linkage
			SAFE_RELEASE(mClassLinkage)
			if (mD3D11Device->GetFeatureLevel() == D3D_FEATURE_LEVEL_11_0)
			{
				HRESULT hr = mD3D11Device->CreateClassLinkage(&mClassLinkage);
			}
        }
	}
	//---------------------------------------------------------------------
	D3D11Device::D3D11Device() : mD3D11Device(0), mImmediateContext(0), mClassLinkage(0)
	{
	}
	//---------------------------------------------------------------------
	D3D11Device::~D3D11Device()
	{
	}
	//---------------------------------------------------------------------
	ID3D11DeviceN * D3D11Device::operator=( ID3D11DeviceN * D3D11device )
	{
		mD3D11Device = D3D11device;
		if (D3D11device)
		{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
			D3D11device->GetImmediateContext(&mImmediateContext);
#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
		    D3D11device->GetImmediateContext1(&mImmediateContext);
#endif

			// If feature level is 11, create class linkage
			SAFE_RELEASE(mClassLinkage);
			if (mD3D11Device->GetFeatureLevel() >= D3D_FEATURE_LEVEL_11_0)
			{
				HRESULT hr = mD3D11Device->CreateClassLinkage(&mClassLinkage);
			}

		}
		return mD3D11Device;
	}
	//---------------------------------------------------------------------
	const bool D3D11Device::isNull()
	{
		return mD3D11Device == 0;
	}
	//---------------------------------------------------------------------
	const String D3D11Device::getErrorDescription(const HRESULT lastResult /* = NO_ERROR */) const
	{
		if (!mD3D11Device)
		{
			return "NULL device";
		}

		if (D3D_NO_EXCEPTION == mExceptionsErrorLevel)
		{
			return "infoQ exceptions are turned off";
		}

		String res;

		switch (lastResult)
		{
		case NO_ERROR:
			break;
		case E_INVALIDARG:
			res = res + "invalid parameters were passed.\n";
			break;
		default:
			;//assert(false); // unknown HRESULT
		}

		if (mInfoQueue != NULL)
		{
			UINT64 numStoredMessages = mInfoQueue->GetNumStoredMessages();
			for (UINT64 i = 0 ; i < numStoredMessages ; i++ )
			{
				// Get the size of the message
				SIZE_T messageLength = 0;
				mInfoQueue->GetMessage(i, NULL, &messageLength);
				// Allocate space and get the message
				D3D11_MESSAGE * pMessage = (D3D11_MESSAGE*)malloc(messageLength);
				mInfoQueue->GetMessage(i, pMessage, &messageLength);
				res = res + pMessage->pDescription + "\n";
				free(pMessage);
			}
		}

		return res;
	}
	//---------------------------------------------------------------------
	void D3D11Device::release()
	{
		// Clear state
		if (mImmediateContext)
		{
			mImmediateContext->Flush();
			mImmediateContext->ClearState();
		}
        SAFE_RELEASE(mInfoQueue);
		SAFE_RELEASE(mD3D11Device);
        SAFE_RELEASE(mImmediateContext);
		SAFE_RELEASE(mClassLinkage);
	}
	//---------------------------------------------------------------------
	ID3D11DeviceN * D3D11Device::get()
	{
		return mD3D11Device;
	}
	//---------------------------------------------------------------------
	void D3D11Device::setExceptionsErrorLevel( const eExceptionsErrorLevel exceptionsErrorLevel )
	{
		mExceptionsErrorLevel = exceptionsErrorLevel;
	}
	//---------------------------------------------------------------------
	const D3D11Device::eExceptionsErrorLevel D3D11Device::getExceptionsErrorLevel()
	{
		return mExceptionsErrorLevel;
	}
    //---------------------------------------------------------------------
    const bool D3D11Device::_getErrorsFromQueue() const
    {
        if (mInfoQueue != NULL)
        {
            UINT64 numStoredMessages = mInfoQueue->GetNumStoredMessages();

            if (D3D_INFO == mExceptionsErrorLevel && numStoredMessages > 0)
            {
                // if D3D_INFO we don't need to loop if the numStoredMessages > 0
                return true;
            }
            for (UINT64 i = 0 ; i < numStoredMessages ; i++ )
            {
                // Get the size of the message
                SIZE_T messageLength = 0;
                mInfoQueue->GetMessage(i, NULL, &messageLength);
                // Allocate space and get the message
                D3D11_MESSAGE * pMessage = (D3D11_MESSAGE*)malloc(messageLength);
                mInfoQueue->GetMessage(i, pMessage, &messageLength);

                bool res = false;
                switch(pMessage->Severity)
                {
                case D3D11_MESSAGE_SEVERITY_CORRUPTION:
                    if (D3D_CORRUPTION == mExceptionsErrorLevel)
                    {
                        res = true;
                    }
                    break;
                case D3D11_MESSAGE_SEVERITY_ERROR:
                    switch(mExceptionsErrorLevel)
                    {
                    case D3D_INFO:
                    case D3D_WARNING:
                    case D3D_ERROR:
                        res = true;
                    }
                    break;
                case D3D11_MESSAGE_SEVERITY_WARNING:
                    switch(mExceptionsErrorLevel)
                    {
                    case D3D_INFO:
                    case D3D_WARNING:
                        res = true;
                    }
                    break;
                }

                free(pMessage);
                if (res)
                {
                    // we don't need to loop anymore...
                    return true;
                }

            }

            clearStoredErrorMessages();

            return false;

        }
        else
        {
            return false;
        }
    }

    const void D3D11Device::clearStoredErrorMessages() const
    {
        if (mD3D11Device && D3D_NO_EXCEPTION != mExceptionsErrorLevel)
        {
            if (mInfoQueue != NULL)
            {
                mInfoQueue->ClearStoredMessages();
            }
        }
    }

	//---------------------------------------------------------------------
}


text:
package main

// Tests of 'what' queries, -format=json.
// See go.tools/oracle/oracle_test.go for explanation.
// See what-json.golden for expected query results.

func main() {
	f() // @what call "f"
}


text:
<?php

namespace Oro\Bundle\CalendarBundle\Tests\Functional\DataFixtures;

use Doctrine\Persistence\ObjectManager;
use Oro\Bundle\OrganizationBundle\Entity\Organization;
use Oro\Bundle\TestFrameworkBundle\Test\DataFixtures\AbstractFixture;

class LoadOrganizationData extends AbstractFixture
{
    /**
     * @var array
     */
    protected $data = [
        [
            'name'      => 'Foo Inc.',
            'enabled'   => true,
            'reference' => 'oro_calendar:organization:foo',
        ],
        [
            'name'      => 'Bar Inc.',
            'enabled'   => true,
            'reference' => 'oro_calendar:organization:bar',
        ],
    ];

    /**
     * {@inheritdoc}
     */
    public function load(ObjectManager $manager)
    {
        // Add system organization to reference repository
        $organization = $manager->getRepository('OroOrganizationBundle:Organization')->getFirst();
        $this->setReference('oro_calendar:organization:system', $organization);

        // Persist other organizations
        foreach ($this->data as $data) {
            $entity = new Organization();

            $this->setEntityPropertyValues($entity, $data, ['reference']);

            $this->setReference($data['reference'], $entity);

            $manager->persist($entity);
        }

        $manager->flush();
    }
}


text:
package org.asteriskjava.manager.event;

import java.util.Map;

/**
 * A StatusEvent is triggered for each active channel in response to a
 * StatusAction.
 *
 * @author srt
 * @version $Id$
 * @see org.asteriskjava.manager.action.StatusAction
 */
public class StatusEvent extends ResponseEvent
{
    /**
     * Serial version identifier.
     */
    private static final long serialVersionUID = -3619197512835308812L;
    private String channel;
    private String accountCode;
    private Integer seconds;
    private String bridgedChannel;
    private String bridgedUniqueId;
    private String uniqueId;
    private String linkedId;
    private String data;
    private String readFormat;
    private String writeFormat;
    private String type;
    private String effectiveConnectedLineName;
    private String effectiveConnectedLineNum;
    private String application;
    private String callGroup;
    private String nativeFormats;
    private String pickupGroup;
    private String timeToHangup;
    private Map<String, String> variables;
    private String dnid;
    private String writetrans;
    private String bridgeId;
    private String readtrans;

    public StatusEvent(Object source)
    {
        super(source);
    }

    /**
     * Returns the name of this channel.
     *
     * @return the name of this channel.
     */
    public String getChannel()
    {
        return channel;
    }

    /**
     * Sets the name of this channel.
     *
     * @param channel the name of this channel.
     */
    public void setChannel(String channel)
    {
        this.channel = channel;
    }

    /**
     * Returns the Caller*ID Number of this channel.
     *

     * This property is deprecated as of Asterisk 1.4, use
     * {@link #getCallerIdNum()} instead.
     *
     * @return the Caller*ID Number of this channel or null if none
     *         is available.
     * @deprecated
     */
    @Deprecated
    public String getCallerId()
    {
        return callerIdNum;
    }

    /**
     * Sets the Caller*ID Number of this channel.
     *

     * This property is deprecated as of Asterisk 1.4.
     *
     * @param callerIdNum the Caller*ID Number to set.
     */
    public void setCallerId(String callerIdNum)
    {
        this.callerIdNum = callerIdNum;
    }

    /**
     * Returns the account code of this channel.
     *
     * @return the account code of this channel.
     * @since 1.0.0
     */
    public String getAccountCode()
    {
        return accountCode;
    }

    /**
     * Sets the account code of this channel.
     *
     * @param accountCode the account code of this channel.
     * @since 1.0.0
     */
    public void setAccountCode(String accountCode)
    {
        this.accountCode = accountCode;
    }

    /**
     * Returns the account code of this channel.
     *
     * @return the account code of this channel.
     * @deprecated since 1.0.0, use {@link #getAccountCode()} instead.
     */
    @Deprecated
    public String getAccount()
    {
        return accountCode;
    }

    /**
     * Sets the account code of this channel.
     *

     * Asterisk versions up to 1.4 use the "Account" property instead of
     * "AccountCode".
     *
     * @param account the account code of this channel.
     */
    public void setAccount(String account)
    {
        this.accountCode = account;
    }

    /**
     * Returns the state of the channel as a descriptive text.
     *
     * @return the state of the channel as a descriptive text.
     * @deprecated use {@link #getChannelStateDesc()} instead.
     */
    @Deprecated
    public String getState()
    {
        return getChannelStateDesc();
    }

    public void setState(String state)
    {
        setChannelStateDesc(state);
    }

    public String getExtension()
    {
        return getExten();
    }

    public void setExtension(String extension)
    {
        setExten(extension);
    }

    /**
     * Returns the number of elapsed seconds.
     *
     * @return the number of elapsed seconds.
     */
    public Integer getSeconds()
    {
        return seconds;
    }

    /**
     * Sets the number of elapsed seconds.
     *
     * @param seconds the number of elapsed seconds.
     */
    public void setSeconds(Integer seconds)
    {
        this.seconds = seconds;
    }

    /**
     * Returns the name of the linked channel if this channel is bridged.
     *
     * @return the name of the linked channel if this channel is bridged.
     * @since 1.0.0
     */
    public String getBridgedChannel()
    {
        return bridgedChannel;
    }

    /**
     * Sets the name of the linked channel.
     *
     * @param bridgedChannel the name of the linked channel if this channel is
     *            bridged.
     * @since 1.0.0
     */
    public void setBridgedChannel(String bridgedChannel)
    {
        this.bridgedChannel = bridgedChannel;
    }

    /**
     * Returns the name of the linked channel if this channel is bridged.
     *
     * @return the name of the linked channel if this channel is bridged.
     * @deprecated as of 1.0.0, use {@link #getBridgedChannel()} instead.
     */
    @Deprecated
    public String getLink()
    {
        return bridgedChannel;
    }

    /**
     * Sets the name of the linked channel.
     *

     * Asterisk versions up to 1.4 use "Link" instead of "BridgedChannel".
     *
     * @param link the name of the linked channel if this channel is bridged.
     */
    public void setLink(String link)
    {
        this.bridgedChannel = link;
    }

    /**
     * Returns the unique id of the linked channel if this channel is bridged.
     *

     * Available since Asterisk 1.6.
     *
     * @return the unique id of the linked channel if this channel is bridged.
     * @since 1.0.0
     */
    public String getBridgedUniqueId()
    {
        return bridgedUniqueId;
    }

    /**
     * Sets the unique id of the linked channel if this channel is bridged.
     *

     * Available since Asterisk 1.6.
     *
     * @param bridgedUniqueId the unique id of the linked channel if this
     *            channel is bridged.
     * @since 1.0.0
     */
    public void setBridgedUniqueId(String bridgedUniqueId)
    {
        this.bridgedUniqueId = bridgedUniqueId;
    }

    /**
     * Returns the unique id of this channel.
     *
     * @return the unique id of this channel.
     */
    public String getUniqueId()
    {
        return uniqueId;
    }

    /**
     * Sets the unique id of this channel.
     *
     * @param uniqueId the unique id of this channel.
     */
    public void setUniqueId(String uniqueId)
    {
        this.uniqueId = uniqueId;
    }

    /**
     * Returns the channel variables if the
     * {@link org.asteriskjava.manager.action.StatusAction#setVariables(String)}
     * property has been set.
     *

     * Available since Asterisk 1.6
     *
     * @return the channel variables.
     * @since 1.0.0
     */
    public Map<String, String> getVariables()
    {
        return variables;
    }

    /**
     * Sets the channel variables.
     *

     * Available since Asterisk 1.6
     *
     * @param variables the channel variables.
     * @since 1.0.0
     */
    public void setVariables(Map<String, String> variables)
    {
        this.variables = variables;
    }

    public String getLinkedId()
    {
        return linkedId;
    }

    public void setLinkedId(String linkedId)
    {
        this.linkedId = linkedId;
    }

    public String getData()
    {
        return data;
    }

    public void setData(String data)
    {
        this.data = data;
    }

    public String getReadFormat()
    {
        return readFormat;
    }

    public void setReadFormat(String readFormat)
    {
        this.readFormat = readFormat;
    }

    public String getWriteFormat()
    {
        return writeFormat;
    }

    public void setWriteFormat(String writeFormat)
    {
        this.writeFormat = writeFormat;
    }

    public String getType()
    {
        return type;
    }

    public void setType(String type)
    {
        this.type = type;
    }

    public String getEffectiveConnectedLineName()
    {
        return effectiveConnectedLineName;
    }

    public void setEffectiveConnectedLineName(String effectiveConnectedLineName)
    {
        this.effectiveConnectedLineName = effectiveConnectedLineName;
    }

    public String getEffectiveConnectedLineNum()
    {
        return effectiveConnectedLineNum;
    }

    public void setEffectiveConnectedLineNum(String effectiveConnectedLineNum)
    {
        this.effectiveConnectedLineNum = effectiveConnectedLineNum;
    }

    public String getApplication()
    {
        return application;
    }

    public void setApplication(String application)
    {
        this.application = application;
    }

    public String getCallGroup()
    {
        return callGroup;
    }

    public void setCallGroup(String callGroup)
    {
        this.callGroup = callGroup;
    }

    public String getNativeFormats()
    {
        return nativeFormats;
    }

    public void setNativeFormats(String nativeFormats)
    {
        this.nativeFormats = nativeFormats;
    }

    public String getPickupGroup()
    {
        return pickupGroup;
    }

    public void setPickupGroup(String pickupGroup)
    {
        this.pickupGroup = pickupGroup;
    }

    public String getTimeToHangup()
    {
        return timeToHangup;
    }

    public void setTimeToHangup(String timeToHangup)
    {
        this.timeToHangup = timeToHangup;
    }

    /**
     * @return the dnid
     */
    public String getDnid()
    {
        return dnid;
    }

    /**
     * @param dnid the dnid to set
     */
    public void setDnid(String dnid)
    {
        this.dnid = dnid;
    }

    /**
     * @return the writetrans
     */
    public String getWritetrans()
    {
        return writetrans;
    }

    /**
     * @param writetrans the writetrans to set
     */
    public void setWritetrans(String writetrans)
    {
        this.writetrans = writetrans;
    }

    /**
     * @return the bridgeid
     */
    public String getBridgeId()
    {
        return bridgeId;
    }

    /**
     * @param bridgeid the bridgeid to set
     */
    public void setBridgeId(String bridgeid)
    {
        this.bridgeId = bridgeid;
    }

    /**
     * @return the readtrans
     */
    public String getReadtrans()
    {
        return readtrans;
    }

    /**
     * @param readtrans the readtrans to set
     */
    public void setReadtrans(String readtrans)
    {
        this.readtrans = readtrans;
    }
}


text:
package ontopoly.utils;

import org.apache.commons.lang3.StringUtils;

public final class Ordering {

  public static final int ORDER_INCREMENTS = 1000;
  public static final int MAX_ORDER = Integer.MAX_VALUE - 1;

  public static int stringToOrder(String order) {
    return (order == null ? Integer.MAX_VALUE : Integer.parseInt(order));
  }

  public static String orderToString(int order) {
    return StringUtils.leftPad(Integer.toString(order), 9, '0');
  }

}