text:
#ifndef HDFSCPP_H_
#define HDFSCPP_H_

#include <hdfs.h>
#include <stdexcept>
#include <vector>
#include <string>

// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
// -- from google c++ style guide
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
  TypeName(const TypeName&);               \
  TypeName& operator=(const TypeName&)

namespace tmacam {
namespace hdfs {

typedef std::vector<std::string> HostList;
typedef std::vector<HostList> BlockLocationList;

/*** Generic class to signal errors from HDFS run-time
 */
class HDFSError : public std::runtime_error {
    // I could try to get some information about the cause of the error
    // from errno but in most cases is just a EINTERNAL, so, really, who cares?
public:
    HDFSError(const std::string& arg) : std::runtime_error(arg) {};
};

class FileInfoList {
public:
    FileInfoList();
    ~FileInfoList();

    //! Implicitly act as a hdfsFileInfo pointer
    inline operator hdfsFileInfo*() { return files_info_ ;};

    inline hdfsFileInfo* operator->() { return files_info_ ;};

    inline int size() const {return n_;};

    inline int empty() const {return 0 == n_;};

    /**Forcibly deletes the managed hdfsFileInfo array
     *  @param  file_info  new hdfsFileInfo array to manage
     *  @param  num_entries  number of entries in this hdfsFileInfo
     *
     *  This object now @e owns the object pointed to by @a file_info.  The
     *  previous object has been deleted.
     */
    void reset(hdfsFileInfo* file_info=NULL, int num_entries=0);
private:
    int n_;
    hdfsFileInfo* files_info_;
    DISALLOW_COPY_AND_ASSIGN(FileInfoList);
};

/**RAII-wrapper for hdfsFile handles
 *
 * XXX Our constructor and the form we use this class is not consistent
 * with FileInfoList, i.e., there is no "uninitialized" state, you
 * cannot open files directly from FileSystem instances, etc. But, you
 * know what, this is way simpler and turning this into a auto_ptr like,
 * with reset() methods and such.
 *
 */
class File {
public:
    /**Default (and only) constructor.
     *
     * Open a hdfs file in given mode.
     *
     * @param fs The configured filesystem handle.
     * @param path The full path to the file.
     * @param flags Either O_RDONLY or O_WRONLY, for read-only or write-only.
     * @param bufferSize Size of buffer for read/write - pass 0 if you want
     * to use the default configured values.
     * @param replication Block replication - pass 0 if you want to use
     * the default configured values.
     * @param blocksize Size of block - pass 0 if you want to use the
     * default configured values.
     *
     * @throws HDFSError if we fail to open the file.
     */

    File(hdfsFS fs, const char* path,  int flags, int bufferSize=0,
            short replication=0, tSize blocksize=0);

    ~File() { hdfsCloseFile(fs_, fh_); }

    //! Implicitly act as a hdfsFile handle
    inline operator hdfsFile() { return fh_ ;};

    /**Read data from an open file.
     * @param buffer The buffer to copy read bytes into.
     * @param length The length of the buffer.
     * @return Returns the number of bytes actually read, possibly less
     * than than length.
     *
     * @throw HDFSError on error.
     */
    tSize Read(void* buffer, tSize length);

    /**Positional read of data from an open file.
     * @param position Position from which to read
     * @param buffer The buffer to copy read bytes into.
     * @param length The length of the buffer.
     * @return Returns the number of bytes actually read.
     * @throw HDFSError on error.
     */
    tSize Pread(tOffset position, void* buffer, tSize length);

    /**Get the number of bytes that can be read from this
     * input stream without blocking.
     *
     * @return Returns available bytes; -1 on error.
     */
    int Available() { return hdfsAvailable(fs_, fh_); }

private:
    hdfsFS fs_;
    hdfsFile fh_;

    DISALLOW_COPY_AND_ASSIGN(File);
    /** Default constructor is not available. Our only constructor is an
     * improved wrapper for hdfsOpenFile().
     */
    File();
};

/***RAII-wrapper for hdfsFS handles
 */
class FileSystem {
public:
    //!Default constructor
    FileSystem(const char* host = "default", tPort port = 0);

    ~FileSystem();

    //! Implicitly act as a hdfsFS handle
    inline operator hdfsFS() { return fs_ ;};

    void GetPathInfo(const char* path, FileInfoList* info);

    void ListDirectory(const char* path, FileInfoList* info);

    /**Checks if a given path exsits on the filesystem
     * @param path The path to look for
     * @return Returns true on success, false on error.
     */
    bool Exists(const char* path);

    /**Do a forcefull reconection of the filesystem .
     *
     * Don't use this function unless necessary.
     */
    void Reconnect();

private:
    const char* host_;
    std::string host_str_copy_; //<! hosts points to me IFF it is not NULL
    tPort port_;
    hdfsFS fs_;
    DISALLOW_COPY_AND_ASSIGN(FileSystem);
};

/**Get hostnames where a particular block (determined by
 * pos & blocksize) of a file is stored.
 *
 * Due to replication, a single block could be present on
 * multiple hosts.
 *
 * @param fs The configured filesystem handle.
 * @param path The path of the file.
 * @param start The start of the block.
 * @param length The length of the block.
 * @param blocks_location Where the resulting lists of block locations
 * will be stored. Any information previously stored in the provided
 * argument will be lost after the return of the function call.
 *
 * @throws HDFSError if anything goes wrong...
 */
void GetFileBlockLocations(hdfsFS fs, const char* path, tOffset start,
        tOffset size, BlockLocationList* blocks_location);

/**Retrieve a sorted list of the entries inside a given directory
 *
 * @param fs FileSystem handle
 * @param path Path to be checked. Should be a directory.
 * @param files Vector through which the file list will be returned.
 *
 */
void ListDirectoryEntries(FileSystem* fs, const char* path,
        std::vector<std::string>* files);

/**Retrieves the full content of a file
 *
 * @param fs FileSystem handle
 * @param path Path to the file we want to read
 * @param file_info The contents of this vector will be overwritten with the
 *  contents of path.
 */
void ReadFullHDFSFile(FileSystem* fs, const char* path,
        std::vector<char>* file_data);

}; // namespace hdfs
}; // namespace tmacam

#endif // HDFSCPP_H_
// vim: et ai sts=4 ts=4 sw=4


text:
package com.orionplatform.data.data_model.user.documents.legal;

import com.orionplatform.core.abstraction.OrionModel;
import com.orionplatform.core.object.CloningService;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@NoArgsConstructor
@AllArgsConstructor
@Builder
@Getter
@Setter
public class OrionLegalDocumentTypeModel extends OrionModel
{
    private int legalDocumentTypeID;
    private String legalDocumentType;

    public static synchronized OrionLegalDocumentTypeModel of()
    {
        return OrionLegalDocumentTypeModel.builder().build();
    }

    public static synchronized OrionLegalDocumentTypeModel of(int legalDocumentTypeID)
    {
        return OrionLegalDocumentTypeModel.builder().legalDocumentTypeID(legalDocumentTypeID).build();
    }

    @Override
    public OrionLegalDocumentTypeModel clone()
    {
        return (OrionLegalDocumentTypeModel)CloningService.clone(this);
    }

    @Override
    public OrionLegalDocumentTypeModel getCopy()
    {
        return this.clone();
    }
}

redpajama_set_name: RedPajamaGithub


text:
// -----------------------------------------------------------------------
// <copyright file="MyDBContext.cs" company="">
// Copyright 2013 Alexander Soffronow Pagonidis
// </copyright>
// -----------------------------------------------------------------------

using System.Data.Entity;
using EntityData.Migrations;
using QDMS;

namespace EntityData
{
    public partial class MyDBContext : DbContext
    {
        public MyDBContext()
            : base("Name=qdmsEntities")
        {
        }

        public DbSet<Instrument> Instruments { get; set; }
        public DbSet<Tag> Tags { get; set; }
        public DbSet<Exchange> Exchanges { get; set; }
        public DbSet<Datasource> Datasources { get; set; }
        public DbSet<SessionTemplate> SessionTemplates { get; set; }
        public DbSet<ExchangeSession> ExchangeSessions { get; set; }
        public DbSet<InstrumentSession> InstrumentSessions { get; set; }
        public DbSet<TemplateSession> TemplateSessions { get; set; }
        public DbSet<UnderlyingSymbol> UnderlyingSymbols { get; set; }
        public DbSet<ContinuousFuture> ContinuousFutures { get; set; }
        public DbSet<DataUpdateJobDetails> DataUpdateJobs { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new InstrumentConfig());
            modelBuilder.Configurations.Add(new TagConfig());
            modelBuilder.Configurations.Add(new ExchangeConfig());
            modelBuilder.Configurations.Add(new DatasourceConfig());
            modelBuilder.Configurations.Add(new UnderlyingSymbolConfig());
            modelBuilder.Configurations.Add(new ContinuousFutureConfig());
            modelBuilder.Configurations.Add(new DataUpdateJobConfig());

            modelBuilder.Entity<ExchangeSession>().ToTable("exchangesessions");
            modelBuilder.Entity<InstrumentSession>().ToTable("instrumentsessions");
            modelBuilder.Entity<TemplateSession>().ToTable("templatesessions");

            modelBuilder.Entity<Instrument>()
            .HasMany(c => c.Tags)
            .WithMany()
            .Map(x =>
            {
                x.MapLeftKey("InstrumentID");
                x.MapRightKey("TagID");
                x.ToTable("tag_map");
            });

            modelBuilder.Entity<Instrument>().Property(x => x.Strike).HasPrecision(16, 8);
            modelBuilder.Entity<Instrument>().Property(x => x.MinTick).HasPrecision(16, 8);

            modelBuilder.Entity<ExchangeSession>().Property(x => x.OpeningTime).HasPrecision(0);
            modelBuilder.Entity<ExchangeSession>().Property(x => x.ClosingTime).HasPrecision(0);

            modelBuilder.Entity<InstrumentSession>().Property(x => x.OpeningTime).HasPrecision(0);
            modelBuilder.Entity<InstrumentSession>().Property(x => x.ClosingTime).HasPrecision(0);

            modelBuilder.Entity<TemplateSession>().Property(x => x.OpeningTime).HasPrecision(0);
            modelBuilder.Entity<TemplateSession>().Property(x => x.ClosingTime).HasPrecision(0);

            Database.SetInitializer(new MigrateDatabaseToLatestVersion<MyDBContext, MyDbContextConfiguration>());
        }
    }
}


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>colour.adaptation.cmccat2000 Module — Colour 0.3.5 documentation</title>

    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootswatch-3.1.0/colour/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="_static/styles.css" type="text/css" />

    <link rel="top" title="Colour 0.3.5 documentation" href="index.html" />
    <link rel="up" title="colour.adaptation Package" href="colour.adaptation.html" />
    <link rel="next" title="colour.adaptation.fairchild1990 Module" href="colour.adaptation.fairchild1990.html" />
    <link rel="prev" title="colour.adaptation.cie1994 Module" href="colour.adaptation.cie1994.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

          Colour 0.3

colour-science.org

                   Documentation

                           API Reference

                           IPython Notebooks

                           Features

                           Contributing

    « colour.adaptatio...

    colour.adaptatio... »

<form class="navbar-form navbar-right" action="search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

colour.adaptation.cmccat2000 Module¶

CMCCAT2000 Chromatic Adaptation Model¶

Defines CMCCAT2000 chromatic adaptation model objects:

<tt class="xref py py-class docutils literal">CMCCAT2000_InductionFactors</tt>

<tt class="xref py py-class docutils literal">CMCCAT2000_VIEWING_CONDITIONS</tt>

<tt class="xref py py-func docutils literal">CMCCAT2000_forward()</tt>

<tt class="xref py py-func docutils literal">CMCCAT2000_reverse()</tt>

<tt class="xref py py-func docutils literal">chromatic_adaptation_CMCCAT2000()</tt>

See also

CMCCAT2000 Chromatic Adaptation Model IPython Notebook

References

<colgroup><col class="label" /><col /></colgroup>

[1]	Li, C., Luo, M. R., Rigg, B., & Hunt, R. W. G. (2002). CMC 2000
chromatic adaptation transform: CMCCAT2000. Color Research & …, 27(1),
49–58. doi:10.1002/col.10005

<colgroup><col class="label" /><col /></colgroup>

[2]	Westland, S., Ripamonti, C., & Cheung, V. (2012). CMCCAT2000. In
Computational Colour Science Using MATLAB (2nd ed., pp. 83–86).
ISBN:978-0-470-66569-5

<tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">CMCCAT2000_INVERSE_CAT</tt> = array([[ 1.07645005, -0.23766239,  0.16121234],        [ 0.41096433,  0.5543418 ,  0.03469387],        [-0.01095377, -0.01338936,  1.02434312]])¶

Inverse CMCCAT2000_CAT chromatic adaptation transform.

CMCCAT2000_INVERSE_CAT : array_like, (3, 3)

class <tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">CMCCAT2000_InductionFactors</tt>[source]¶

Bases: <tt class="xref py py-class docutils literal">colour.adaptation.cmccat2000.CMCCAT2000_InductionFactors</tt>

CMCCAT2000 chromatic adaptation model induction factors.

<col class="field-name" />
<col class="field-body" />

Parameters:	F (numeric or array_like) – \(F\) surround condition.

<tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">CMCCAT2000_VIEWING_CONDITIONS</tt> = CaseInsensitiveMapping({u'Dark': CMCCAT2000_InductionFactors(F=0.8), u'Dim': CMCCAT2000_InductionFactors(F=0.8), u'Average': CMCCAT2000_InductionFactors(F=1.0)})¶

Reference CMCCAT2000 chromatic adaptation model viewing conditions.

CMCCAT2000_VIEWING_CONDITIONS : CaseInsensitiveMapping

(‘Average’, ‘Dim’, ‘Dark’)

<tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">CMCCAT2000_forward</tt><big>(</big>XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, surround=CMCCAT2000_InductionFactors(F=1.0)<big>)</big>[source]¶

Adapts given stimulus CIE XYZ tristimulus values from test viewing
conditions to reference viewing conditions using CMCCAT2000 forward
chromatic adaptation model.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values of the stimulus to adapt.

XYZ_w (array_like) – Test viewing condition CIE XYZ tristimulus values of the whitepoint.

XYZ_wr (array_like) – Reference viewing condition CIE XYZ tristimulus values of the
whitepoint.

L_A1 (numeric or array_like) – Luminance of test adapting field \(L_{A1}\) in \(cd/m^2\).

L_A2 (numeric or array_like) – Luminance of reference adapting field \(L_{A2}\) in \(cd/m^2\).

surround (CMCCAT2000_InductionFactors, optional) – Surround viewing conditions induction factors.

Returns:
CIE XYZ_c tristimulus values of the stimulus corresponding colour.

Return type:
ndarray

Warning

The input and output domains of that definition are non standard!

Notes

Input CIE XYZ, CIE XYZ_w and CIE XYZ_wr tristimulus values are in
domain [0, 100].

Output CIE XYZ_c tristimulus values are in domain [0, 100].

Examples

>>> XYZ = np.array([22.48, 22.74, 8.54])
>>> XYZ_w = np.array([111.15, 100.00, 35.20])
>>> XYZ_wr = np.array([94.81, 100.00, 107.30])
>>> L_A1 = 200
>>> L_A2 = 200
>>> CMCCAT2000_forward(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2)
array([ 19.5269832...,  23.0683396...,  24.9717522...])

<tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">CMCCAT2000_reverse</tt><big>(</big>XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2, surround=CMCCAT2000_InductionFactors(F=1.0)<big>)</big>[source]¶

Adapts given stimulus corresponding colour CIE XYZ tristimulus values
from reference viewing conditions to test viewing conditions using
CMCCAT2000 reverse chromatic adaptation model.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values of the stimulus to adapt.

XYZ_w (array_like) – Test viewing condition CIE XYZ tristimulus values of the whitepoint.

XYZ_wr (array_like) – Reference viewing condition CIE XYZ tristimulus values of the
whitepoint.

L_A1 (numeric or array_like) – Luminance of test adapting field \(L_{A1}\) in \(cd/m^2\).

L_A2 (numeric or array_like) – Luminance of reference adapting field \(L_{A2}\) in \(cd/m^2\).

surround (CMCCAT2000_InductionFactors, optional) – Surround viewing conditions induction factors.

Returns:
CIE XYZ_c tristimulus values of the adapted stimulus.

Return type:
ndarray

Warning

The input and output domains of that definition are non standard!

Notes

Input CIE XYZ_c, CIE XYZ_w and CIE XYZ_wr tristimulus values
are in domain [0, 100].

Output CIE XYZ tristimulus values are in domain [0, 100].

Examples

>>> XYZ_c = np.array([19.53, 23.07, 24.97])
>>> XYZ_w = np.array([111.15, 100.00, 35.20])
>>> XYZ_wr = np.array([94.81, 100.00, 107.30])
>>> L_A1 = 200
>>> L_A2 = 200
>>> CMCCAT2000_reverse(XYZ_c, XYZ_w, XYZ_wr, L_A1, L_A2)
array([ 22.4839876...,  22.7419485...,   8.5393392...])

<tt class="descclassname">colour.adaptation.cmccat2000.</tt><tt class="descname">chromatic_adaptation_CMCCAT2000</tt><big>(</big>XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, surround=CMCCAT2000_InductionFactors(F=1.0), method=u'Forward'<big>)</big>[source]¶

Adapts given stimulus CIE XYZ tristimulus values using given viewing
conditions.

This definition is a convenient wrapper around <tt class="xref py py-func docutils literal">CMCCAT2000_forward()</tt>
and <tt class="xref py py-func docutils literal">CMCCAT2000_reverse()</tt>.

<col class="field-name" />
<col class="field-body" />

Parameters:

XYZ (array_like) – CIE XYZ tristimulus values of the stimulus to adapt.

XYZ_w (array_like) – Source viewing condition CIE XYZ tristimulus values of the
whitepoint.

XYZ_wr (array_like) – Target viewing condition CIE XYZ tristimulus values of the
whitepoint.

L_A1 (numeric or array_like) – Luminance of test adapting field \(L_{A1}\) in \(cd/m^2\).

L_A2 (numeric or array_like) – Luminance of reference adapting field \(L_{A2}\) in \(cd/m^2\).

surround (CMCCAT2000_InductionFactors, optional) – Surround viewing conditions induction factors.

method (unicode, optional) – {‘Forward’, ‘Reverse’}
Chromatic adaptation method.

Returns:
Adapted stimulus CIE XYZ tristimulus values.

Return type:
ndarray

Warning

The input and output domains of that definition are non standard!

Notes

Input CIE XYZ, CIE XYZ_w and CIE XYZ_wr tristimulus values are in
domain [0, 100].

Output CIE XYZ tristimulus values are in domain [0, 100].

Examples

>>> XYZ = np.array([22.48, 22.74, 8.54])
>>> XYZ_w = np.array([111.15, 100.00, 35.20])
>>> XYZ_wr = np.array([94.81, 100.00, 107.30])
>>> L_A1 = 200
>>> L_A2 = 200
>>> chromatic_adaptation_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, method='Forward')
array([ 19.5269832...,  23.0683396...,  24.9717522...])

Using the CMCCAT2000 reverse model:

>>> XYZ = np.array([19.52698326, 23.06833960, 24.97175229])
>>> XYZ_w = np.array([111.15, 100.00, 35.20])
>>> XYZ_wr = np.array([94.81, 100.00, 107.30])
>>> L_A1 = 200
>>> L_A2 = 200
>>> chromatic_adaptation_CMCCAT2000(XYZ, XYZ_w, XYZ_wr, L_A1, L_A2, method='Reverse')
array([ 22.48,  22.74,   8.54])

      Back to top

        © Copyright 2013 - 2015, Colour Developers.

      Created using Sphinx 1.2.2.


text:
{% if site.search %}

{% endif %}
{% if site.owner.google.analytics %}

{% endif %}


text:
import BaseController from './BaseController';

class UserController extends BaseController {
  getAllUsers(token) {
    return this.get('/users', null, token);
  }

  createUser(user, token) {
    return this.post('/user', {
      email: user.email,
      password: user.password,
      name: user.name || '',
      isAdmin: user.isAdmin || false
    }, token);
  }
}

export default UserController;


text:
package org.hisp.dhis.programrule.engine;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.when;

import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import org.hisp.dhis.DhisConvenienceTest;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.programrule.ProgramRule;
import org.hisp.dhis.user.CurrentUserService;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserRole;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import com.google.common.collect.Lists;
import com.google.common.collect.Sets;

@ExtendWith( MockitoExtension.class )
class SupplementaryDataProviderTest extends DhisConvenienceTest
{

    private static final String ORG_UNIT_GROUP_UID = "OrgUnitGroupId";

    private static final String NOT_NEEDED_ORG_UNIT_GROUP_UID = "NotNeededOrgUnitGroupId";

    @Mock
    private OrganisationUnitGroupService organisationUnitGroupService;

    @Mock
    private CurrentUserService currentUserService;

    @InjectMocks
    private SupplementaryDataProvider providerToTest;

    private OrganisationUnit orgUnitA;

    private OrganisationUnit orgUnitB;

    @BeforeEach
    void setUp()
    {
        User user = makeUser( "A" );
        user.setUserRoles( getUserRoles() );
        when( currentUserService.getCurrentUser() ).thenReturn( user );
        orgUnitA = createOrganisationUnit( 'A' );
        orgUnitB = createOrganisationUnit( 'B' );
        OrganisationUnitGroup orgUnitGroup = createOrganisationUnitGroup( 'A' );
        orgUnitGroup.setUid( ORG_UNIT_GROUP_UID );
        orgUnitGroup.setMembers( Sets.newHashSet( orgUnitA ) );
        OrganisationUnitGroup notNeededOrgUnitGroup = createOrganisationUnitGroup( 'B' );
        notNeededOrgUnitGroup.setUid( NOT_NEEDED_ORG_UNIT_GROUP_UID );
        notNeededOrgUnitGroup.setMembers( Sets.newHashSet( orgUnitB ) );
        when( organisationUnitGroupService.getOrganisationUnitGroup( ORG_UNIT_GROUP_UID ) ).thenReturn( orgUnitGroup );
    }

    @Test
    void getSupplementaryData()
    {
        Map<String, List<String>> supplementaryData = providerToTest.getSupplementaryData( getProgramRules() );
        assertFalse( supplementaryData.isEmpty() );
        assertEquals( getUserRoleUids(), supplementaryData.get( "USER" ) );
        assertFalse( supplementaryData.get( ORG_UNIT_GROUP_UID ).isEmpty() );
        assertEquals( orgUnitA.getUid(), supplementaryData.get( ORG_UNIT_GROUP_UID ).get( 0 ) );
        assertNull( supplementaryData.get( NOT_NEEDED_ORG_UNIT_GROUP_UID ) );
    }

    private List<ProgramRule> getProgramRules()
    {
        ProgramRule programRule = createProgramRule( 'A', null );
        programRule.setCondition( "d2:inOrgUnitGroup('OrgUnitGroupId')" );
        return Lists.newArrayList( programRule );
    }

    private List<String> getUserRoleUids()
    {
        return getUserRoles().stream().map( UserRole::getUid ).collect( Collectors.toList() );
    }

    private Set<UserRole> getUserRoles()
    {
        UserRole groupA = createUserRole( 'A' );
        UserRole groupB = createUserRole( 'B' );
        return Sets.newHashSet( groupA, groupB );
    }
}


text:
package uo.ri.business.dto;

import java.util.Date;

public class InvoiceDto {

	public Long id; // the internal (db) id
	public double total; // total amount (money) vat included
	public double vat; // amount of vat (money)
	public long number; // the invoice identity, a sequential number
	public Date date; // of the invoice
	public String status; // the status as in FacturaStatus

}


text:
/************************************************************************
 *
 * Filename:		node.cc
 * Authors:			YL,LH,PH
 *
 * Description:		Node.cc is the base class, from which all operations
 * 					inherit common variables and functions.
 *
 * 					This base class contains the 'virtual' Execute function
 * 					through which run-time polymorphism is achieved.
 *
 * 					The file also contains helper functions used for
 * 					comparing common information. An additional function
 * 					for printing out the stored variables is also included
 * 					for debugging purposes.
 *
 * **********************************************************************/

#include "node.h"

//DEBUG
void Node::Print_Data()
{
	std::cout << Function << std::endl;
	std::cout << Data << std::endl;
}

bool Node::Compare_Data(std::string data)
{
	bool j;
	//removes all spaces
	std::string temp = Data;
	std::string::iterator end_pos = std::remove(temp.begin(), temp.end(), ' ');
	temp.erase(end_pos, temp.end());

	j = (data==temp);
	return j;
}

bool Node::Compare_Func(std::string data)
{
	bool j;
	//removes all spaces
	std::string temp = Function;
	std::string::iterator end_pos = std::remove(temp.begin(), temp.end(), ' ');
	temp.erase(end_pos, temp.end());

	j = (data==temp);
	return j;
}

bool Node::FindOperatorVals(std::size_t found, int &iLeftVal, int &iRightVal, std::string StoredData, std::map<std::string, int> &v)
{

	std::string Left_Val;
	std::string Right_Val;

	Left_Val = StoredData.substr(0, found);  //place content to Left_Val (string)
	StoredData.erase (0, found+1);
	Right_Val = StoredData;					//place content to Right_Val (string)
	std::map<std::string, int>::iterator i_temp;	//used to search through the variable map

	//assessment of value on the left hand side
	if(v.find(Left_Val) != v.end())
	{
		i_temp = v.find(Left_Val);
		iLeftVal = v[i_temp->first];
	}
	else if(is_Number(Left_Val))
	{
		iLeftVal = atoi(Left_Val.c_str());
	}
	else
	{
		return 0; //return false - (error)
	}

	//assessment of the value on the right hand side
	if(v.find(Right_Val) != v.end())
	{
		i_temp = v.find(Right_Val);
		iRightVal = v[i_temp->first];
	}
	else if(is_Number(Right_Val))
	{
		iRightVal = atoi(Right_Val.c_str());

	}
	else
	{
		return 0; //return false - error
	}

	return 1; //returns true - success
}

bool Node::is_Number(std::string& s)
{
	//helper function to check if the entered string is a number
    std::string::const_iterator it = s.begin();
    while (it != s.end() && std::isdigit(*it)) ++it;
    return !s.empty() && it == s.end();
}


text:
package org.kuali.kra.award.home;

import org.kuali.kra.bo.KraPersistableBusinessObjectBase;
import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;

/**
 *
 * This class represents Distribution business object and is mapped
 * with DISTRIBUTION table.
 */
public class Distribution extends KraPersistableBusinessObjectBase implements MutableInactivatable {

    /**
     * Comment for serialVersionUID
     */
    private static final long serialVersionUID = -8638092879516673772L;

    private String ospDistributionCode;

    private String description;

    private boolean active;

    /**
     * Constructs a Distribution.java
     */
    public Distribution() {
    }

    /**
     *
     * @return
     */
    public String getOspDistributionCode() {
        return ospDistributionCode;
    }

    /**
     *
     * @param ospDistributionCode
     */
    public void setOspDistributionCode(String ospDistributionCode) {
        this.ospDistributionCode = ospDistributionCode;
    }

    /**
     *
     * @return
     */
    public String getDescription() {
        return description;
    }

    /**
     *
     * @param description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int PRIME = 31;
        int result = 1;
        result = PRIME * result + ((ospDistributionCode == null) ? 0 : ospDistributionCode.hashCode());
        return result;
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Distribution)) {
            return false;
        }
        return equals((Distribution) obj);
    }

    /**
     *
     * Convenience method for equality of Distribution
     * @param distribution
     * @return
     */
    public boolean equals(Distribution distribution) {
        if (ospDistributionCode == null) {
            if (distribution.ospDistributionCode != null) {
                return false;
            }
        } else if (!ospDistributionCode.equals(distribution.ospDistributionCode)) {
            return false;
        }
        return true;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }
}


text:
package com.ajayhao.simpleboot.service.antxchecker;

import com.ajayhao.simpleboot.dto.antxchecker.AntxCheckDetail;

import java.util.List;

/**
 * Created by AjayHao on 2018/2/18.
 */
public interface AntxCheckerService {

    List<AntxCheckDetail> checkAntx(String inputPath, String antxContent);
}


text:
import computation_graph

def train_songs(force_reload=False):
	computation_graph.train_songs(force_reload)


text:
export default {
  globals: {
    '@angular/animations': 'ng.animations',
    '@angular/common': 'ng.common',
    '@angular/compiler': 'ng.compiler',
    '@angular/core': 'ng.core',
    '@angular/forms': 'ng.forms',
    '@angular/http': 'ng.http',
    '@angular/platform-browser': 'ng.platformBrowser',
    '@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
    '@angular/router': 'ng.router',
    'microedge-rxstate/dist': 'MicroedgeRxState',
    'moment': 'moment',
    'ng2-dragula/ng2-dragula': 'ng2.dragula',
    'rxjs/Observable': 'Rx',
    'rxjs/BehaviorSubject': 'Rx',
    'rxjs/ReplaySubject': 'Rx',
    'rxjs/Subject': 'Rx',
    'rxjs/Subscription': 'Rx',
    'rxjs/add/observable/combineLatest': 'Rx.Observable',
    'rxjs/add/observable/fromEvent': 'Rx.Observable',
    'rxjs/add/observable/of': 'Rx.Observable',
    'rxjs/add/operator/distinctUntilChanged': 'Rx.Observable.prototype',
    'rxjs/add/operator/filter': 'Rx.Observable.prototype',
    'rxjs/add/operator/map': 'Rx.Observable.prototype',
    'rxjs/add/operator/mergeMap': 'Rx.Observable.prototype',
    'rxjs/add/operator/skip': 'Rx.Observable.prototype',
    'rxjs/add/operator/takeUntil': 'Rx.Observable.prototype',
    'rxjs/add/operator/take': 'Rx.Observable.prototype'
  },
  external: [
    '@angular/animations',
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    'microedge-rxstate/dist',
    'moment',
    'ng2-dragula/ng2-dragula',
    'rxjs/Observable',
    'rxjs/BehaviorSubject',
    'rxjs/ReplaySubject',
    'rxjs/Subject',
    'rxjs/Subscription',
    'rxjs/add/observable/combineLatest',
    'rxjs/add/observable/fromEvent',
    'rxjs/add/observable/of',
    'rxjs/add/operator/distinctUntilChanged',
    'rxjs/add/operator/filter',
    'rxjs/add/operator/map',
    'rxjs/add/operator/mergeMap',
    'rxjs/add/operator/skip',
    'rxjs/add/operator/takeUntil',
    'rxjs/add/operator/take'
  ]
};


text:
/*
 * getpkginfo-tasks
 *
 * An API for interacting with package information for internal CI.
 *
 * For details check README.md
*/

/*jshint -W024, node: true */
/*global module, process */
'use strict';

var appRoot = require('app-root-path'),
    PACKAGE_JSON = require(appRoot + '/package.json'),
    git = require('git-rev-sync'),
    normalizeUrl = require('normalize-url'),
    moment = require('moment');

function fullversion() {
  var currentDate = moment().format('YYYYMMDDHHss'),
      version = PACKAGE_JSON.version + '-' + currentDate + '-' + git.short();

  return version;
}

function pkgsemver() {
  return PACKAGE_JSON.version;
}

function pkgname() {
  return PACKAGE_JSON.name;
}

function dataload() {
  var REGISTRY_URLBASE = (process.env.REGISTRY_URLBASE === undefined) ?
                         'https://artifacts.aue1d.saasure.com/artifactory' : process.env.REGISTRY_URLBASE;

  var dataload = normalizeUrl(
                   REGISTRY_URLBASE +
                   '/api/storage/npm-okta/' +
                   pkgname() +
                   '/-/' +
                   pkgname() +
                   '-' +
                   pkgsemver() +
                   '.tgz?properties=buildVersion=' +
                   fullversion()
                 );

  return dataload;
}

module.exports = {
  fullversion : fullversion,
  dataload : dataload,
  pkgsemver : pkgsemver,
  pkgname : pkgname
};


text:
[angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.24.

## Development server

$ ng serve

manual => http://localhost:4200/

$ ng serve --open

auto open => http://localhost:4200/

## Code scaffolding

$ ng generate component component-name

$ ng generate directive/pipe/service/class/module

## Build

$ ng build

dist/

$ ng build -prod

production build

## Running unit tests

$ ng test

unit tests

[Karma](https://karma-runner.github.io)

## Running end-to-end tests

$ ng serve
$ ng e2e

end-to-end tests

[Protractor](http://www.protractortest.org/)

## Deploying to Github Pages

$ ng github-pages:deploy

deploy to Github Pages.

## Further help

$ ng help

[Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).


text:
Simple directive to create a Instagram card.

## install
Install with bower

```cmd
bower install ng-insta-card --save
```

or npm

```cmd
npm install ng-insta-card --save
```
or download manually

## usage

Include the Instagram library, and include the directive module.

```html
<script src="http://platform.instagram.com/en_US/embeds.js"></script>
<script src="bower/ng-insta-card/dist/ng-insta-card.min.js"></script>
```
Include 'ng-insta-card' in your dependencies.
Now you can create a Instagram card with the following markup.

```html
<insta-card insta-id="7NcWOyzBM9"></insta-card>
<div insta-card insta-id="7NcWOyzBM9"></div>
<div insta-card="7NcWOyzBM9"></div>
<div class="insta-card:7NcWOyzBM9;"></div>
```


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Bernize's Portfolio Webpage</title>
    <link rel="stylesheet" href="css/foundation.css">
    <link rel="stylesheet" href="css/app.css">

Welcome to Foundation


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('osf', '0014_merge'),
    ]

    operations = [
        migrations.AddField(
            model_name='preprintprovider',
            name='domain',
            field=models.URLField(blank=True, null=True),
        ),
    ]


text:
class StrDemo {
	public static void main(String args[]) {
		System.out.println("First line\nSecond line");
		System.out.println("A\tB\tC");
		System.out.println("D\tE\tF");
	}
}


text:
<?php

namespace Boomerang;

$req      = new HttpRequest('http://httpbin.org/get');
$response = $req->makeRequest();

$valid = new HttpResponseValidator($response);
$valid->expectStatus(200)
	  ->expectHeaderContains('Content-Type', 'json');

Boomerang::addValidator($valid);


text:
chromeMyAdmin.controller("MainFooterController", ["$scope", "modeService", "mySQLClientService", "rowsPagingService", "rowsSelectionService", "targetObjectService", "Events", "Modes", "relationSelectionService", "TableTypes", "routineSelectionService", "anyQueryExecuteService", "querySelectionService", "ConfigurationTabs", function($scope, modeService, mySQLClientService, rowsPagingService, rowsSelectionService, targetObjectService, Events, Modes, relationSelectionService, TableTypes, routineSelectionService, anyQueryExecuteService, querySelectionService, ConfigurationTabs) {
    "use strict";

    var showMainStatusMessage = function(message) {
        $scope.safeApply(function() {
            $scope.mainStatusMessage = message;
        });
    };

    var _hasPrevisouPage = function() {
        return rowsPagingService.hasPrevious();
    };

    var _hasNextPage = function() {
        return rowsPagingService.hasNext();
    };

    $scope.initialize = function() {
        $scope.$on(Events.SHOW_MAIN_STATUS_MESSAGE, function(event, message) {
            showMainStatusMessage(message);
        });
    };

    $scope.isRowsButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.ROWS;
    };

    $scope.isStructureButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.STRUCTURE;
    };

    $scope.isDatabaseButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.DATABASE;
    };

    $scope.isInformationButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.INFORMATION;
    };

    $scope.isRelationButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.RELATION;
    };

    $scope.isProceduresFunctionsButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.PROCS_FUNCS;
    };

    $scope.isQueryButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.QUERY;
    };

    $scope.isErDiagramButtonsVisible = function() {
        return mySQLClientService.isConnected() && modeService.getMode() === Modes.ER_DIAGRAM;
    };

    $scope.hasPreviousPage = function() {
        return _hasPrevisouPage();
    };

    $scope.hasNextPage = function() {
        return _hasNextPage();
    };

    $scope.goPreviousPage = function() {
        if (_hasPrevisouPage()) {
            rowsPagingService.previous();
        }
    };

    $scope.goNextPage = function() {
        if (_hasNextPage()) {
            rowsPagingService.next();
        }
    };

    $scope.getPagingInfo = function() {
        return (rowsPagingService.getCurrentPageIndex() + 1) + "/" + rowsPagingService.getTotalPageCount();
    };

    $scope.refreshRows = function() {
        rowsPagingService.refresh();
    };

    $scope.refreshStructure = function() {
        targetObjectService.reSelectTable();
    };

    $scope.isRowSelection = function() {
        if (rowsSelectionService.getSelectedRows() &&
           modeService.getMode() === Modes.ROWS) {
            return true;
        } else {
            return false;
        }
    };

    $scope.confirmDeleteSelectedRow = function() {
        if ($scope.isTable() && $scope.isRowSelection()) {
            $scope.showConfirmDialog(
                "Once deleted data will be undone. Would you really like to delete the selected row from MySQL server?",
                "Yes",
                "No",
                Events.DELETE_SELECTED_ROW,
                true
            );
        }
    };

    $scope.isTableSelection = function() {
        return targetObjectService.getTable();
    };

    $scope.isTable = function() {
        var table = targetObjectService.getTable();
        if (table) {
            return table.type === TableTypes.BASE_TABLE;
        } else {
            return false;
        }
    };

    $scope.insertRow = function() {
        if ($scope.isTable()) {
            targetObjectService.requestInsertRow();
        }
    };

    $scope.updateRow = function() {
        if ($scope.isTable() && $scope.isRowSelection()) {
            targetObjectService.requestUpdateRow();
        }
    };

    $scope.createDatabase = function() {
        targetObjectService.showCreateDatabaseDialog();
    };

    $scope.isDatabaseSelection = function() {
        return targetObjectService.getDatabase();
    };

    $scope.confirmDeleteSelectedDatabase = function() {
        $scope.showConfirmDialog(
            "Once deleted data will be undone. Would you really like to delete the selected database from MySQL server?",
            "Yes",
            "No",
            Events.DELETE_SELECTED_DATABASE,
            true
        );
    };

    $scope.refreshInformation = function() {
        targetObjectService.reSelectTable();
    };

    $scope.refreshRelation = function() {
        targetObjectService.reSelectTable();
    };

    $scope.isRelationSelection = function() {
        return relationSelectionService.getSelectedRelation();
    };

    $scope.confirmDeleteSelectedRelation = function() {
        if ($scope.isTable() && $scope.isRelationSelection()) {
            $scope.showConfirmDialog(
                "Once deleted data will be undone. Would you really like to delete the selected relation from the database?",
                "Yes",
                "No",
                Events.DELETE_SELECTED_RELATION,
                true
            );
        }
    };

    $scope.addRelation = function() {
        var table = targetObjectService.getTable();
        if (table && table.type === TableTypes.BASE_TABLE) {
            targetObjectService.showAddRelationDialog(table.name);
        }
    };

    $scope.refreshProceduresFunctions = function() {
        targetObjectService.refreshProceduresFunctions();
    };

    $scope.isRoutineSelection = function() {
        return routineSelectionService.getSelectedRoutine();
    };

    $scope.confirmDeleteSelectedRoutine = function() {
        if ($scope.isRoutineSelection()) {
            $scope.showConfirmDialog(
                "Once deleted data will be undone. Would you really like to delete the selected routine from the database?",
                "Yes",
                "No",
                Events.DELETE_SELECTED_ROUTINE,
                true
            );
        }
    };

    $scope.createRoutine = function() {
        if (targetObjectService.getDatabase()) {
            routineSelectionService.showCreateRoutineDialog();
        }
    };

    $scope.isProcedureSelection = function() {
        var routine = routineSelectionService.getSelectedRoutine();
        return routine && routine.entity.ROUTINE_TYPE === "PROCEDURE";
    };

    $scope.executeProcedure = function() {
        if ($scope.isProcedureSelection()) {
            routineSelectionService.executeSelectedProcedure();
        }
    };

    $scope.findSameRows = function() {
        if ($scope.isTable() && $scope.isRowSelection()) {
            anyQueryExecuteService.showFindSameRowsDialog();
        }
    };

    $scope.findRowsWithTheValue = function() {
        if ($scope.isTable() && $scope.isRowSelection()) {
            anyQueryExecuteService.showFindRowsWithTheValueDialog();
        }
    };

    $scope.exportQueryResult = function() {
        if ($scope.isQueryResultSelection()) {
            querySelectionService.exportQueryResult();
        }
    };

    $scope.isQueryResultSelection = function() {
        var queryResult = querySelectionService.getQueryResult();
        return queryResult && queryResult.success && queryResult.result.hasResultsetRows;
    };

    $scope.isQueryResultRowSelection = function() {
        var queryResult = querySelectionService.getQueryResult();
        var selectedRows = querySelectionService.getSelectedRows();
        return queryResult && queryResult.success && queryResult.result.hasResultsetRows && selectedRows;
    };

    $scope.copyQueryResultRowToClipboard = function() {
        if ($scope.isQueryResultRowSelection()) {
            querySelectionService.copyRowToClipboard();
        }
    };

    $scope.copyRowsPanelRowToClipboard = function() {
        if ($scope.isRowSelection()) {
            rowsSelectionService.copyRowToClipboard();
        }
    };

    $scope.refreshErDiagram = function() {
        if ($scope.isDatabaseSelection()) {
            targetObjectService.refreshErDiagram();
        }
    };

    $scope.saveErDiagramImage = function() {
        if ($scope.isDatabaseSelection()) {
            targetObjectService.saveErDiagramImage();
        }
    };

    $scope.openErDiagramConfiguration = function() {
        $scope.showConfigurationDialog(ConfigurationTabs.ER_DIAGRAM);
    };

    $scope.exportAllDatabases = function() {
        targetObjectService.exportAllDatabases();
    };

}]);


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Michelia 2(no. 6): 4 (1880)

#### Original name
Dendrophoma cytisporoides var. cytisporoides Sacc.

### Remarks
null


text:
package org.elasticsearch.spark.sql

import scala.collection.mutable.ArrayBuffer
import org.elasticsearch.hadoop.serialization.builder.JdkValueReader
import org.elasticsearch.hadoop.util.StringUtils
import org.elasticsearch.hadoop.cfg.Settings
import scala.collection.mutable.LinkedHashMap

class JdkRowValueReader extends JdkValueReader with RowValueReader {

  override def createMap() = {
    new JavaEsRow(new ScalaEsRow(createBuffer))
  }

  override def addToMap(map: AnyRef, key: AnyRef, value: AnyRef) = {
    addToBuffer(map.asInstanceOf[JavaEsRow].esrow.values, key, value)
  }
}


text:
Version 2.0.15 by Volodymyr Volynets

	<time class="change_log_date_commit" datetime="2019-02-17">2019-02-17</time>

Frontend

	Enhancement #1204 (Readonly checkbox. Form and Bootstrap renderers.)

Repository / Git:
	Name: Numbers\Frontend
	Title: Frontend Repository
	Version: 2.0.14
	Last Tag: 2.0.14
	User Name: Volodymyr Volynets
	User Email: volodymyr.volynets@gmail.com
Statistics:
	Addition: 67
	Deletion: 12
Modules:
	Checkbox Component (Numbers.Frontend.Components.Checkbox.Numbers, 1.0.2)                  |     4    4
		    4    4	 | Components/Checkbox/Numbers/Media/CSS/Base.css
	Form HTML Renderer (Numbers\Frontend\HTML\Form\Renderers\HTML, 1.0.8)                     |    56    6
		   52    6	 | HTML/Form/Renderers/HTML/Base.php
		    4    0	 | HTML/Form/Renderers/HTML/Media/CSS/Base.css
	Bootstrap Renderer (Numbers\Frontend\HTML\Renderers\Bootstrap, 1.0.3)                     |     4    1
		    4    1	 | HTML/Renderers/Bootstrap/Base.php
	Frontend Repository (Numbers\Frontend, 2.0.14)                                            |     3    1
		    3    1	 | HTML/Renderers/Common/Base.php


text:
package net.roboconf.messaging.api.client.idle;

import org.junit.Assert;
import org.junit.Test;

import net.roboconf.messaging.api.MessagingConstants;

/**
 * @author Vincent Zurczak - Linagora
 */
public class IdleClientTest {

	@Test
	public void testClientMethods() throws Exception {

		IdleClient client = new IdleClient();

		// Basic checks
		Assert.assertFalse( client.isConnected());
		client.openConnection();
		Assert.assertTrue( client.isConnected());
		client.closeConnection();
		Assert.assertFalse( client.isConnected());

		Assert.assertNotNull( client.getMessagingType());
		Assert.assertNotNull( client.getConfiguration());

		Assert.assertEquals( 1, client.getConfiguration().size());
		Assert.assertEquals(
				MessagingConstants.FACTORY_IDLE,
				client.getConfiguration().get( MessagingConstants.MESSAGING_TYPE_PROPERTY ));

		// Not checkable
		client.deleteMessagingServerArtifacts( null );
		client.publish( null, null );
		client.subscribe( null );
		client.unsubscribe( null );
		client.setMessageQueue( null );
		client.setOwnerProperties( null, null, null, null );
	}
}


text:
package elasta.core.promise.impl;

/**
 * Created by someone on 26/08/2015.
 */
final class SimpleCounter {
    public int counter = 0;

    public SimpleCounter() {
    }

    public SimpleCounter(final int counter) {
        this.counter = counter;
    }
}


text:
"""
    sphinx.builders.dummy
    ~~~~~~~~~~~~~~~~~~~~~

    Do syntax checks, but no writing.

    :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

from sphinx.builders import Builder
from sphinx.locale import __

if False:
    # For type annotation
    from typing import Any, Dict, Set  # NOQA
    from docutils import nodes  # NOQA
    from sphinx.application import Sphinx  # NOQA

class DummyBuilder(Builder):
    name = 'dummy'
    epilog = __('The dummy builder generates no files.')

    allow_parallel = True

    def init(self):
        # type: () -> None
        pass

    def get_outdated_docs(self):
        # type: () -> Set[str]
        return self.env.found_docs

    def get_target_uri(self, docname, typ=None):
        # type: (str, str) -> str
        return ''

    def prepare_writing(self, docnames):
        # type: (Set[str]) -> None
        pass

    def write_doc(self, docname, doctree):
        # type: (str, nodes.Node) -> None
        pass

    def finish(self):
        # type: () -> None
        pass

def setup(app):
    # type: (Sphinx) -> Dict[str, Any]
    app.add_builder(DummyBuilder)

    return {
        'version': 'builtin',
        'parallel_read_safe': True,
        'parallel_write_safe': True,
    }


text:
package com.bonevich.ecslocal.api;

import com.amazonaws.services.ecs.model.CreateClusterRequest;
import com.amazonaws.services.ecs.model.CreateClusterResult;
import com.bonevich.ecslocal.application.EcsApplication;

import static com.bonevich.ecslocal.domain.model.EcsLocalException.invalidParameterException;
import static com.bonevich.ecslocal.domain.model.ObjectUtils.isNotBlank;

public class CreateCluster implements EcsApi<CreateClusterRequest> {

    private EcsApplication application;

    public CreateCluster(EcsApplication application) {
        this.application = application;
    }

    @Override
    public CreateClusterResult execute(CreateClusterRequest request) {
        return new CreateClusterResult().withCluster(application.createCluster(request.getClusterName()));
    }

    @Override
    public void validate(CreateClusterRequest request) {
        String clusterName = request.getClusterName();
        if (isNotBlank(clusterName)) {
            if (!clusterName.matches("^[a-zA-Z0-9\\-_]{1,255}$")) {
                throw invalidParameterException("Cluster name must match ^[a-zA-Z0-9\\\\-_]{1,255}$, but was " + clusterName);
            }
        }
    }

}


text:
/* @flow */

// NOTE: the following code is based on
// https://github.com/flowtype/flow-language-server/blob/fbd1bc3/src/pkg/nuclide-flow-rpc/lib/astToOutline.js
// and adjusted to toggle keywords and function arguments

import { Point } from 'atom'
import invariant from 'assert'
import type { Outline, OutlineTree, TokenizedText } from 'atom-ide-ui/outline'
import * as Text from './text'
import type { OutlineOptions, Extent } from './types'

function exportDeclaration(
  options: OutlineOptions,
  item: Object,
  extent: Extent,
  isDefault: boolean,
): ?OutlineTree {
  const tree = itemToTree(options, item.declaration) // eslint-disable-line
  if (tree == null) {
    return null
  }
  // Flow always has tokenizedText
  invariant(tree.tokenizedText != null)

  const tokenizedText = []
  if (options.showKeywords.export) {
    tokenizedText.push(Text.keyword('export'), Text.whitespace(' '))
  }
  if (options.showKeywords.default && isDefault) {
    tokenizedText.push(Text.keyword('default'), Text.whitespace(' '))
  }
  tokenizedText.push(...tree.tokenizedText)

  return {
    kind: tree.kind,
    tokenizedText,
    representativeName: tree.representativeName,
    children: tree.children,
    ...extent,
  }
}

function declarationsTokenizedText(options: OutlineOptions, declarations: Array<Object>): TokenizedText {
  return declarations.reduce((text, decl, i, decls) => {
    text.push(...declarationReducer(options, decl)) // eslint-disable-line
    if (i < decls.length - 1) {
      text.push(Text.plain(','))
      text.push(Text.whitespace(' '))
    }
    return text
  }, [])
}

function declarationReducer(
  options: OutlineOptions,
  decl: Object,
): TokenizedText {
  if (!decl) {
    // special case: array patterns can contain `null` elements
    // which means that this value is simply ignored.
    return []
  }

  switch (decl.type) {
    case 'Identifier':
      return [Text.param(decl.name)]
    case 'ObjectPattern':
      return [
        Text.plain('{'),
        ...declarationsTokenizedText(options, decl.properties),
        Text.plain('}'),
      ]
    case 'ArrayPattern':
      return [
        Text.plain('['),
        ...declarationsTokenizedText(options, decl.elements),
        Text.plain(']'),
      ]
    case 'AssignmentPattern':
      return declarationReducer(options, decl.left)
    case 'RestElement':
    case 'RestProperty':
      return [
        Text.plain('...'),
        ...declarationReducer(options, decl.argument),
      ]
    case 'Property':
      return declarationReducer(options, decl.value)
    default:
      throw new Error(`encountered unexpected argument type ${decl.type}`)
  }
}

function getExtent(item: Object): Extent {
  return {
    startPosition: new Point(
      // It definitely makes sense that the lines we get are 1-based and the columns are
      // 0-based... convert to 0-based all around.
      item.loc.start.line - 1,
      item.loc.start.column,
    ),
    endPosition: new Point(item.loc.end.line - 1, item.loc.end.column),
  }
}

function functionOutline(
  options: OutlineOptions,
  name: string,
  params: Array<Object>,
  extent: Extent,
): OutlineTree {
  const tokenizedText = []

  if (options.showKeywords.function || !name) {
    tokenizedText.push(Text.keyword('function'))
    if (name) {
      tokenizedText.push(Text.whitespace(' '))
    }
  }
  if (name) {
    tokenizedText.push(Text.method(name))
  }
  if (options.showFunctionArgs) {
    tokenizedText.push(
      Text.plain('('),
      ...declarationsTokenizedText(options, params),
      Text.plain(')'),
    )
  }

  return {
    kind: 'function',
    tokenizedText,
    representativeName: name,
    children: [],
    ...extent,
  }
}

function typeAliasOutline(options: OutlineOptions, typeAliasExpression: Object): OutlineTree {
  invariant(typeAliasExpression.type === 'TypeAlias' || typeAliasExpression.type === 'DeclareTypeAlias')
  const name = typeAliasExpression.id.name

  const tokenizedText = []
  if (options.showKeywords.type) {
    tokenizedText.push(Text.keyword('type'), Text.whitespace(' '))
  }
  tokenizedText.push(Text.type(name))

  return {
    kind: 'interface',
    tokenizedText,
    representativeName: name,
    children: [],
    ...getExtent(typeAliasExpression),
  }
}

function isModuleExports(left: Object): boolean {
  return (
    left.type === 'MemberExpression' &&
    left.object.type === 'Identifier' &&
    left.object.name === 'module' &&
    left.property.type === 'Identifier' &&
    left.property.name === 'exports'
  )
}

function moduleExportsPropertyOutline(options: OutlineOptions, property: Object): ?OutlineTree {
  invariant(property.type === 'Property')
  if (property.key.type !== 'Identifier') {
    return null
  }
  const propName = property.key.name

  if (property.shorthand) {
    // This happens when the shorthand `{ foo }` is used for `{ foo: foo }`
    return {
      kind: 'method',
      tokenizedText: [Text.string(propName)],
      representativeName: propName,
      children: [],
      ...getExtent(property),
    }
  }

  if (
    property.value.type === 'FunctionExpression' ||
    property.value.type === 'ArrowFunctionExpression'
  ) {
    const tokenizedText = [Text.method(propName)]
    if (options.showFunctionArgs) {
      tokenizedText.push(
        Text.plain('('),
        ...declarationsTokenizedText(options, property.value.params),
        Text.plain(')'),
      )
    }

    return {
      kind: 'method',
      tokenizedText,
      representativeName: propName,
      children: [],
      ...getExtent(property),
    }
  }

  return {
    kind: 'field',
    tokenizedText: [Text.string(propName), Text.plain(':')],
    representativeName: propName,
    children: [],
    ...getExtent(property),
  }
}

function moduleExportsOutline(options: OutlineOptions, assignmentStatement: Object): ?OutlineTree {
  invariant(assignmentStatement.type === 'AssignmentExpression')

  const left = assignmentStatement.left
  if (!isModuleExports(left)) {
    return null
  }

  const right = assignmentStatement.right
  if (right.type !== 'ObjectExpression') {
    return null
  }
  const properties: Array<Object> = right.properties
  return {
    kind: 'module',
    tokenizedText: [Text.plain('module.exports')],
    children: properties.map(prop => moduleExportsPropertyOutline(options, prop)).filter(Boolean),
    ...getExtent(assignmentStatement),
  }
}

// Return the function name as written as a string. Intended to stringify patterns like `describe`
// and `describe.only` even though `describe.only` is a MemberExpression rather than an Identifier.
function getFunctionName(callee: Object): ?string {
  switch (callee.type) {
    case 'Identifier':
      return callee.name
    case 'MemberExpression':
      if (
        callee.object.type !== 'Identifier' ||
        callee.property.type !== 'Identifier'
      ) {
        return null
      }
      return `${callee.object.name}.${callee.property.name}`
    default:
      return null
  }
}

function isDescribe(functionName: string): boolean {
  switch (functionName) {
    case 'describe':
    case 'fdescribe':
    case 'ddescribe':
    case 'xdescribe':
    case 'describe.only':
    case 'describe.skip':
    case 'test.cb':
    case 'test.serial':
    case 'test.todo':
    case 'test.failing':
    case 'test':
    case 'test.concurrent':
    case 'test.only':
    case 'test.skip':
    case 'suite':
    case 'suite.only':
    case 'suite.skip':
    case 'xtest':
    case 'xtest.concurrent':
    case 'xtest.only':
    case 'xtest.skip':
      return true
    default:
      return false
  }
}

function isIt(functionName: string): boolean {
  switch (functionName) {
    case 'it':
    case 'fit':
    case 'iit':
    case 'pit':
    case 'xit':
    case 'it.only':
    case 'it.skip':
      return true
    default:
      return false
  }
}

/** If the given AST Node is a string literal, return its literal value. Otherwise return null */
function getStringLiteralValue(literal: ?Object): ?string {
  if (literal == null) {
    return null
  }
  if (literal.type !== 'Literal') {
    return null
  }
  const value = literal.value
  if (typeof value !== 'string') {
    return null
  }
  return value
}

function getFunctionBody(fn: ?Object): ?Array<Object> {
  if (fn == null) {
    return null
  }
  if (
    fn.type !== 'ArrowFunctionExpression' &&
    fn.type !== 'FunctionExpression'
  ) {
    return null
  }
  return fn.body.body
}

function specOutline(
  options: OutlineOptions,
  expressionStatement: Object,
  describeOnly: boolean = false,
): ?OutlineTree {
  const expression = expressionStatement.expression
  if (expression.type !== 'CallExpression') {
    return null
  }
  const functionName = getFunctionName(expression.callee)
  if (functionName == null) {
    return null
  }
  if (!isDescribe(functionName)) {
    if (describeOnly || !isIt(functionName)) {
      return null
    }
  }
  const description = getStringLiteralValue(expression.arguments[0])
  const specBody = getFunctionBody(expression.arguments[1])
  if (description == null || specBody == null) {
    return null
  }
  let children
  if (isIt(functionName)) {
    children = []
  } else {
    children =
      specBody
        .filter(item => item.type === 'ExpressionStatement')
        .map(item => specOutline(options, item))
        .filter(Boolean)
  }
  return {
    kind: 'function',
    tokenizedText: [Text.method(functionName), Text.whitespace(' '), Text.string(description)],
    representativeName: description,
    children,
    ...getExtent(expressionStatement),
  }
}

function topLevelExpressionOutline(options: OutlineOptions, expressionStatement: Object): ?OutlineTree {
  switch (expressionStatement.expression.type) {
    case 'CallExpression':
      return specOutline(options, expressionStatement, /* describeOnly */ true)
    case 'AssignmentExpression':
      return moduleExportsOutline(options, expressionStatement.expression)
    default:
      return null
  }
}

function variableDeclaratorOutline(
  options: OutlineOptions,
  declarator: Object,
  kind: string,
  extent: Extent,
): ?OutlineTree {
  if (
    declarator.init != null &&
    (declarator.init.type === 'FunctionExpression' ||
      declarator.init.type === 'ArrowFunctionExpression')
  ) {
    return functionOutline(options, declarator.id.name, declarator.init.params, extent)
  }

  const { id } = declarator

  const tokenizedText = []
  if (options.showKeywords[kind]) {
    tokenizedText.push(
      Text.keyword(kind),
      Text.whitespace(' '),
    )
  }
  tokenizedText.push(...declarationsTokenizedText(options, [id]))

  const representativeName = id.type === 'Identifier' ? id.name : undefined
  return {
    kind: kind === 'const' ? 'constant' : 'variable',
    tokenizedText,
    representativeName,
    children: [],
    ...extent,
  }
}

function variableDeclarationOutline(options: OutlineOptions, declaration: Object): ?OutlineTree {
  // If there are multiple var declarations in one line, just take the first.
  return variableDeclaratorOutline(
    options,
    declaration.declarations[0],
    declaration.kind,
    getExtent(declaration),
  )
}

function itemToTree(options: OutlineOptions, item: Object): ?OutlineTree {
  if (item == null) {
    return null
  }
  const extent = getExtent(item)
  switch (item.type) {
    case 'FunctionDeclaration':
    case 'ArrowFunctionExpression':
      return functionOutline(
        options,
        item.id != null ? item.id.name : '',
        item.params,
        extent,
      )
    case 'ClassDeclaration':
    case 'ClassExpression': {
      let representativeName
      if (item.id != null) {
        representativeName = item.id.name
      }

      const tokenizedText = []
      if (options.showKeywords.class || !representativeName) {
        tokenizedText.push(Text.keyword('class'))
      }
      if (representativeName) {
        if (options.showKeywords.class) {
          tokenizedText.push(Text.whitespace(' '))
        }
        tokenizedText.push(Text.className(representativeName))
      }
      return {
        kind: 'class',
        tokenizedText,
        representativeName,
        children: itemsToTrees(options, item.body.body), // eslint-disable-line
        ...extent,
      }
    }
    case 'ClassProperty': {
      if (item.value && item.value.type === 'ArrowFunctionExpression') {
        const tokenizedText = [Text.method(item.key.name)]
        if (options.showFunctionArgs) {
          tokenizedText.push(
            Text.plain('('),
            ...declarationsTokenizedText(options, item.value.params),
            Text.plain(')'),
          )
        }
        return {
          kind: 'method',
          tokenizedText,
          representativeName: item.key.name,
          children: [],
          ...extent,
        }
      }
      return {
        kind: 'property',
        tokenizedText: [Text.param(item.key.name)],
        representativeName: item.key.name,
        children: [],
        ...extent,
      }
    }
    case 'MethodDefinition': {
      const tokenizedText = [Text.method(item.key.name)]
      if (options.showFunctionArgs) {
        tokenizedText.push(
          Text.plain('('),
          ...declarationsTokenizedText(options, item.value.params),
          Text.plain(')'),
        )
      }
      return {
        kind: 'method',
        tokenizedText,
        representativeName: item.key.name,
        children: [],
        ...extent,
      }
    }
    case 'ExportDeclaration':
    case 'ExportNamedDeclaration':
      return exportDeclaration(options, item, extent, Boolean(item.default))
    case 'ExportDefaultDeclaration':
      return exportDeclaration(options, item, extent, true)
    case 'ExpressionStatement':
      return topLevelExpressionOutline(options, item)
    case 'DeclareTypeAlias':
    case 'TypeAlias':
      return typeAliasOutline(options, item)
    case 'VariableDeclaration':
      return variableDeclarationOutline(options, item)
    default:
      return null
  }
}

function itemsToTrees(options: OutlineOptions, items: Array<Object>): Array<OutlineTree> {
  return items.map(item => itemToTree(options, item)).filter(Boolean)
}

export function astToOutline(options: OutlineOptions, ast: Object): Outline {
  return {
    outlineTrees: itemsToTrees(options, ast.body),
  }
}


text:
<?php

namespace PHPExiftool\Driver\Tag\Microsoft;

use JMS\Serializer\Annotation\ExclusionPolicy;
use PHPExiftool\Driver\AbstractTag;

/**
 * @ExclusionPolicy("all")
 */
class UserLastPlayedTime extends AbstractTag
{

    protected $Id = 'UserLastPlayedTime';

    protected $Name = 'UserLastPlayedTime';

    protected $FullName = 'Microsoft::Xtra';

    protected $GroupName = 'Microsoft';

    protected $g0 = 'QuickTime';

    protected $g1 = 'Microsoft';

    protected $g2 = 'Video';

    protected $Type = '?';

    protected $Writable = false;

    protected $Description = 'User Last Played Time';

}


text:
.. title: Customizing the WordPress meta widget
.. category: articles-en
.. slug: customizing-the-wordpress-meta-widget
.. date: 2012-01-26 16:07:18
.. keywords: WordPress, Coding, Engineering, Wikimedia
.. image: /images/2012-01-26_wmblog_widget.png
.. image-caption: Obligatory tilted illustration of part of the code

.. highlights::

    I recently had to investigate how to customize the "meta" widget provided by WordPress. I couldn't find a good how-to at the time, so I wanted to share how I did it, in case other people needed to do the same.

.. note::
    `Jump to the code <#code>`__ if you're not interested in the backstory.

I maintain the `Wikimedia Blog <https://blog.wikimedia.org>`__, and we wanted to include a link to our `posting guidelines <https://meta.wikimedia.org/wiki/Wikimedia_Blog/Guidelines>`__ to the "meta" section of our sidebar.

There is no straightforward way to do this; the widget can't be edited from within the admin area. One possibility was to replace the standard meta widget by a custom text widget, with the same content and links, and to add our guidelines to the mix. But this meant losing the nice context-aware links (e.g. "Register" vs. "Site admin", and "Log in" vs. "Log out", respectively for logged-out and logged-in users) provided by built-in WordPress functions (``wp_register`` and ``wp_loginout``): widget text can't embed PHP code.

Another possibility was to install a third-party plugin to customize the meta widget (or allow PHP code in widget text). I'm usually reluctant to using plugins for simple changes like the one we wanted to do. Both our Operations staff and I prefer to keep the amount of third-party plugins installed on the blog to a minimum, for various reasons (security, maintenance, maintainability, etc.).

Because there are no hooks to plug into the widget's behavior, most of the solutions I've seen online consist either of using a third-party plugin, or messing with WordPress core files, which is a no-go for me. The third possibility, which is the one I went for, was to create our own meta widget. This is what the code below does.

.. figure:: /images/2012-01-26_WMBlog_meta_widget.png
    :alt: Screenshot of the custom meta widget with a link to posting guidelines in the middle of the standard meta widget's content
    :figclass: aside

    Result: Our blog guidelines inserted into the meta widget.

I used the `WordPress widgets API <https://codex.wordpress.org/Widgets_API>`__ to create a widget, as well as the content of the standard meta widget, located in ``wp-includes/default-widgets.php``. The code is located in our |plugin|_, a set of customizations specific to our blog that work independently of the theme.

.. |plugin| replace:: ``WMBlog`` plugin

.. _plugin: https://gerrit.wikimedia.org/r/#/admin/projects/wikimedia/communications/WMBlog,branches

The custom widget replicates the functionality of the standard meta widget (with the handy context-aware links) and also includes the link to our guidelines. It was a bit more work, but it's cleaner and more robust that way. Once the widget is available, an admin can replace the standard widget with the custom one.

If you want to add stuff to the meta widget, or remove some of its standard content, this is probably the Right™ Way to do it. You'll want to look at lines 42 to 51 in the code below.

Note: The code hasn't been deployed to production yet; it'll appear on the Wikimedia blog in a few days.

Code
====

.. code:: php

    <?php
    /*
       Replicate the default meta widget and extend it to include
       a link to the Wikimedia blog guidelines
       See https://codex.wordpress.org/Widgets_API for reference */

    class WMBlog_meta_widget extends WP_Widget {

      function WMBlog_meta_widget() {
        // (constructor) Instantiate the parent object
        parent::WP_Widget( /* Base ID */'WMBlog_meta_widget', /* Name */'WMBlog_meta_widget', array( 'description' => 'The default meta widget plus Wikimedia-specific stuff' ) );
      }

      function form( $instance ) {
        // output the options form on admin
        // i.e. for now only the widget's title
        if ( $instance ) {
          $title = esc_attr( $instance[ 'title' ] );
        }
        else {
          $title = __( 'New title', 'text_domain' );
        }
        ?>

        <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?>
        <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />

        <?php
      }

      function update( $new_instance, $old_instance ) {
        // process widget options to be saved
        $instance = $old_instance;
        $instance['title'] = strip_tags($new_instance['title']);
        return $instance;
      }

      function widget( $args, $instance ) {
        // output the content of the widget
        extract( $args );
        $title = apply_filters( 'widget_title', $instance['title'] );
        echo $before_widget;
        if ( !empty( $title ) ) { echo $before_title . $title . $after_title; } ?>

          <?php wp_register(); ?>

<?php wp_loginout(); ?>

Blog guidelines

<a href="<?php bloginfo('rss2_url'); ?>" title="<?php echo esc_attr(__('Syndicate this site using RSS 2.0')); ?>"><?php _e('Entries RSS'); ?>

<a href="<?php bloginfo('comments_rss2_url'); ?>" title="<?php echo esc_attr(__('The latest comments to all posts in RSS')); ?>"><?php _e('Comments RSS'); ?>

<a href="//wordpress.org/" title="<?php echo esc_attr(__('Powered by WordPress, state-of-the-art semantic personal publishing platform.')); ?>">WordPress.org

          <?php wp_meta(); ?>

        <?php echo $after_widget;
      }

    }

    function WMBlog_register_widgets() {
      // register the plugin's available widgets
      register_widget( 'WMBlog_meta_widget' );
    }

    // plug in the widgets registration
    add_action( 'widgets_init', 'WMBlog_register_widgets' );

    ?>


text:
@implementation UIScreen (ext)
+ (CGSize)size
{
    return [UIScreen mainScreen].bounds.size;
}
+ (float)height
{
    return [UIScreen mainScreen].bounds.size.height;
}
+ (float)width
{
    return [UIScreen mainScreen].bounds.size.width;
}
@end