text:
import scipy
import getopt
import sys
import time
import math
from scipy.interpolate import splprep, splev
from sct_nurbs import NURBS
import sct_utils as sct
import numpy

# check if needed Python libraries are already installed or not
try:
    import nibabel
except ImportError:
    print '--- nibabel not installed! Exit program. ---'
    sys.exit(2)
try:
    import numpy as np
except ImportError:
    print '--- numpy not installed! Exit program. ---'
    sys.exit(2)
try:
    from scipy import ndimage
except ImportError:
    print '--- scipy not installed! Exit program. ---'
    sys.exit(2)

#=======================================================================================================================
# main
#=======================================================================================================================
def main():

    # Initialization
    fname_anat = ''
    fname_centerline = ''
    centerline_fitting = ''
    start_time = time.time()

    # Parameters initialization
    # Width and length of xy zone to smooth in terms of voxels
    x_width_sc = 15
    y_width_sc = 17
    # Length of the vector to smooth in terms of number of voxels
    smooth_extend = 81
    # Standard deviation for Gaussian kernel (in terms of number of voxels) of the filter to apply
    sigma = 16

    # Check input param
    try:
        opts, args = getopt.getopt(sys.argv[1:], 'hi:c:f:')
    except getopt.GetoptError as err:
        print str(err)
        usage()
    for opt, arg in opts:
        if opt == '-h':
            usage()
        elif opt in ('-i'):
            fname_anat = arg
        elif opt in ('-c'):
            fname_centerline = arg
        elif opt in ('-f'):
            centerline_fitting = str(arg)

    # Display usage if a mandatory argument is not provided
    if fname_anat == '' or fname_centerline == '':
        print '\n \n All mandatory arguments are not provided \n \n'
        usage()

    # Display usage if optional arguments are not correctly provided
    if centerline_fitting == '':
        centerline_fitting = 'splines'
    elif not centerline_fitting == '' and centerline_fitting == 'splines' and centerline_fitting == 'polynome':
        print '\n \n -f argument is not valid \n \n'
        usage()

    # Check existence of input files
    sct.check_file_exist(fname_anat)
    sct.check_file_exist(fname_centerline)

    # Extract path/file/extension of the original image file
    path_anat, file_anat, ext_anat = sct.extract_fname(fname_anat)
    # Extract path/file/extension of the centerline
    path_centerline, file_centerline, ext_centerline = sct.extract_fname(fname_centerline)

    # Get input image orientation
    status, output = sct.run('sct_orientation -i ' + fname_anat + ' -get')
    input_image_orientation = output[-3:]
    # Get centerline orientation
    status, output = sct.run('sct_orientation -i ' + fname_centerline + ' -get')
    centerline_orientation = output[-3:]

    # Display arguments
    print '\nCheck input arguments...'
    print '.. Anatomical image:           ' + fname_anat
    print '.... orientation:              ' + input_image_orientation
    print '.. Centerline:                 ' + fname_centerline
    print '.... orientation:              ' + centerline_orientation
    print '.... Centerline fitting option:' + centerline_fitting

    # Change orientation of the input image into RPI
    print '\nOrient input volume to RPI orientation...'
    fname_anat_orient = path_anat+ file_anat+'_rpi'+ ext_anat
    sct.run('sct_orientation -i ' + fname_anat + ' -o ' + fname_anat_orient + ' -orientation RPI')
    # Change orientation of the input image into RPI
    print '\nOrient centerline to RPI orientation...'
    fname_centerline_orient = path_centerline + file_centerline +'_rpi' + ext_centerline
    sct.run('sct_orientation -i ' + fname_centerline + ' -o ' + fname_centerline_orient + ' -orientation RPI')

    # Read nifti anat file
    img = nibabel.load(fname_anat_orient)
    # 3d array for each x y z voxel values for the input nifti image
    data_anat = img.get_data()
    hdr_anat = img.get_header()

    # Read nifti centerline file
    img = nibabel.load(fname_centerline_orient)
    # 3d array for each x y z voxel values for the input nifti image
    data_centerline = img.get_data()
    hdr_centerline = img.get_header()

    # Get dimensions of input centerline
    print '\nGet dimensions of input centerline...'
    nx, ny, nz, nt, px, py, pz, pt = sct.get_dimension(str(fname_centerline_orient))

    # Make a copy of the anatomic image data to be smoothed
    data_anat_smoothed=numpy.copy(data_anat)
    data_anat_smoothed = data_anat_smoothed.astype(float)

    #Loop across z and associate x,y coordinate with the point having maximum intensity
    x_centerline = [0 for iz in range(0, nz, 1)]
    y_centerline = [0 for iz in range(0, nz, 1)]
    z_centerline = [iz for iz in range(0, nz, 1)]
    for iz in range(0, nz, 1):
        x_centerline[iz], y_centerline[iz] = np.unravel_index(data_centerline[:, :, iz].argmax(),
                                                              data_centerline[:, :, iz].shape)
    del data_centerline

    # Fit the centerline points with the kind of curve given as argument of the script and return the new smoothed coordinates
    if centerline_fitting == 'splines':
        x_centerline_fit, y_centerline_fit = b_spline_centerline(x_centerline,y_centerline,z_centerline)
    elif centerline_fitting == 'polynome':
        x_centerline_fit, y_centerline_fit = polynome_centerline(x_centerline,y_centerline,z_centerline)

    # Loop accross the z-slices of the spinal cord
    for z_cl in range(0,nz):

        # Find the nearest coordinates of the centerline point at this z-slice in the anatomic image
        x_cl_anat = round(x_centerline_fit[z_cl])
        y_cl_anat = round(y_centerline_fit[z_cl])

        # Loop accross the points of defined zone of the plane z=z_cl in the anatomic image plane
        for x in range(-int(math.floor(x_width_sc/2)+1),int(math.floor(x_width_sc/2)+1),1):
            for y in range(-int(math.floor(y_width_sc/2)+1),int(math.floor(y_width_sc/2)+1),1):

                # Initialization of the vector to smooth
                vector_to_smooth = numpy.zeros((1,smooth_extend))
                # Filling of the vector to smooth
                for i in range(0,smooth_extend):

                    # Calculate the z coordinate of the slice below and above the considered anatomic z-slice
                    zi = -int(math.floor(smooth_extend/2)) + i + z_cl
                    # CASE: slices on the edges of the image are not taken into account
                    if zi<0 or zi>=nz:
                        zi=0

                    # Calculate the (x,y)
                    x_point_to_interpolate = x_cl_anat + x + (x_centerline_fit[zi]-x_centerline_fit[z_cl])
                    y_point_to_interpolate = y_cl_anat + y + (y_centerline_fit[zi]-y_centerline_fit[z_cl])

                    vector_to_smooth[0][i] = bilin_interpol(data_anat,x_point_to_interpolate,y_point_to_interpolate,zi)

                # Smooth the vector
                vector_smoothed = scipy.ndimage.filters.gaussian_filter1d(vector_to_smooth[0],sigma)

                # Replace the original value by the smoothed value
                data_anat_smoothed[x_cl_anat+x,y_cl_anat+y,z_cl] = vector_smoothed[int(math.floor(smooth_extend/2))]

    # Return the nifti corrected data
    hdr_anat.set_data_dtype('uint8') # set imagetype to uint8
    print '\nWrite NIFTI volumes...'
    img = nibabel.Nifti1Image(data_anat_smoothed, None, hdr_anat)
    nibabel.save(img, 'tmp.anat_smoothed.nii')
    fname_output_image = sct.generate_output_file('tmp.anat_smoothed.nii', './', file_anat+'_centerline_shift_smoothed', ext_anat)

    # Reorient the output image into its initial orientation
    print '\nReorient the output image into its initial orientation...'
    sct.run('sct_orientation -i '+fname_output_image +' -o ' +fname_output_image+' -orientation '+input_image_orientation)

    # Delete temporary files
    print '\nDelete temporary files...'
    sct.run('rm '+fname_anat_orient)
    sct.run('rm '+fname_centerline_orient)

    #Display elapsed time
    elapsed_time = time.time() - start_time
    print '\nFinished!'
    print '.. '+str(int(round(elapsed_time)))+'s\n'

#=======================================================================================================================
# Functions used in the main
#=======================================================================================================================

def find_index_of_nearest_xy(x_array,y_array,x_point,y_point):

    distance2 = (x_array[0]-x_point)**2 + (y_array[0]-y_point)**2
    idx_near = idy_near = 0

    for idx in range(0,len(x_array)):
        for idy in range(0,len(y_array)):
            distance2_old = np.copy(distance2)
            distance2 = (x_array[idx]-x_point)**2 + (y_array[idy]-y_point)**2
            if distance2<distance2_old:
                idx_near = np.copy(idx)
                idy_near = np.copy(idy)

    return idx_near,idy_near

def bilin_interpol(data_interpolating,x_point_to_interpolate,y_point_to_interpolate,z_plane):

    # Lattice point below the point to interpolate in the two dimensions
    x0=math.floor(x_point_to_interpolate)
    y0=math.floor(y_point_to_interpolate)
    # Lattice point above the point to interpolate in the three dimensions
    x1=math.ceil(x_point_to_interpolate)
    y1=math.ceil(y_point_to_interpolate)

    # Let xd ad yd be the differences between the point to interpolate and the smaller coordinate related
    # in the x and y dimensions

    # Avoid the division by 0 if x0=x1 or y0=y1
    if x1 == x0:
        xd = 0
    else:
        xd = (x_point_to_interpolate - x0)/(x1 - x0)

    if y1 == y0:
            yd = 0
    else:
        yd = (y_point_to_interpolate - y0)/(y1 - y0)

    # First we interpolate along x
    v0 = data_interpolating[x0,y0,z_plane]*(1 - xd) + data_interpolating[x1,y0,z_plane]*xd
    v1 = data_interpolating[x0,y1,z_plane]*(1 - xd) + data_interpolating[x1,y1,z_plane]*xd
    # Then we interpolate along y
    v = v0*(1 - yd) + v1*yd

    return v

def spline_centerline(x_centerline,y_centerline,z_centerline):
    """Fit splines to the centerline points given as argument and return the new coordinates
    """

    s=30 # Smoothness parameter
    k=3 # Spline order. k must be in [1,5]
    nest=-1 # Estimate of number of knots needed (-1 = maximal)

    # Find the knot points
    tckp,u = splprep([x_centerline,y_centerline,z_centerline],s=s,k=k,nest=nest)

    # Evaluate spline, including interpolated points
    x_centerline_fit,y_centerline_fit,z_centerline_fit = splev(u,tckp)

    # Find the (x,y) coordinates of the fitted curved corresponding to the original z-slices
    corresponding_id = numpy.zeros(len(z_centerline))
    for idz in z_centerline:
        distance2_z_zfit = (z_centerline_fit-z_centerline[idz])**2
        corresponding_id[idz] = numpy.where(distance2_z_zfit==distance2_z_zfit.min())[0][0]

    x_centerline_fit_match = numpy.zeros(len(z_centerline))
    y_centerline_fit_match = numpy.zeros(len(z_centerline))

    for k in range(0,len(corresponding_id)):
        x_centerline_fit_match[k]=x_centerline_fit[k]
        y_centerline_fit_match[k]=y_centerline_fit[k]

    return x_centerline_fit_match,y_centerline_fit_match

def b_spline_centerline(x_centerline,y_centerline,z_centerline):
    """Give a better fitting of the centerline than the method 'spline_centerline' using b-splines"""

    points = [[x_centerline[n],y_centerline[n],z_centerline[n]] for n in range(len(x_centerline))]

    nurbs = NURBS(3,1000,points) # for the third argument (number of points), give at least len(z_centerline)
    # (len(z_centerline)+500 or 1000 is ok)
    P = nurbs.getCourbe3D()
    x_centerline_fit=P[0]
    y_centerline_fit=P[1]

    return x_centerline_fit, y_centerline_fit

def polynome_centerline(x_centerline,y_centerline,z_centerline):
    """Fit polynomial function through centerline"""

    # Fit centerline in the Z-X plane using polynomial function
    print '\nFit centerline in the Z-X plane using polynomial function...'
    coeffsx = np.polyfit(z_centerline, x_centerline, deg=5)
    polyx = np.poly1d(coeffsx)
    x_centerline_fit = np.polyval(polyx, z_centerline)

    #Fit centerline in the Z-Y plane using polynomial function
    print '\nFit centerline in the Z-Y plane using polynomial function...'
    coeffsy = np.polyfit(z_centerline, y_centerline, deg=5)
    polyy = np.poly1d(coeffsy)
    y_centerline_fit = np.polyval(polyy, z_centerline)

    return x_centerline_fit,y_centerline_fit

#=======================================================================================================================
# usage
#=======================================================================================================================
def usage():
    print '\n' \
          'sct_smooth_spinal_cord_shifting_centerline.py\n' \
          '-------------------------------------------------------------------------------------------------------------\n' \
          'Part of the Spinal Cord Toolbox <https://sourceforge.net/projects/spinalcordtoolbox>\n' \
          '\n' \
          'DESCRIPTION\n' \
          '  This program smooth the input anatomical image along the spinal cord. It works by applying a convolution ' \
          'of a 1D kernel with the anatomical MRI image along the spinal cord. The output is the smoothed anatomical ' \
          'image and RPI oriented.' \
          '\n' \
          'USAGE\n' \
          '  sct_smooth_spinal_cord_shifting_centerline.py -i <input_image> -c <centerine>\n' \
          '\n' \
          'MANDATORY ARGUMENTS\n' \
          '  -i <anat>         anatomic nifti file. Image to smooth.\n' \
          '  -c <centerline>   centerline.\n' \
          '\n' \
          'OPTIONAL ARGUMENTS\n' \
          '  -h                help. Show this message.\n' \
          '  -f                option to choose the centerline fitting method: \'splines\' to fit the centerline with' \
                               'splines, \'polynome\' to fit the centerline with a polynome (default=\'splines\').\n'

    sys.exit(2)

#=======================================================================================================================
# Start program
#=======================================================================================================================
if __name__ == "__main__":
    # call main function
    main()


text:
package st.gravel.systemtests;

import org.junit.Before;
import org.junit.Test;

import st.gravel.support.jvm.runtime.ImageBootstrapper;
import st.gravel.support.jvm.runtime.MethodTools;

public class ExtensibleCollectionTest {
	@Before
	public void setUp() {
		st.gravel.support.compiler.testtools.TestBootstrap.getSingleton();
	}
	@Test
	public void test_addAll_() throws Throwable {
		MethodTools.debugTest("st.gravel.ansitests.ExtensibleCollectionTest", "test_addAll_");
	}
	@Test
	public void test_add_() throws Throwable {
		MethodTools.debugTest("st.gravel.ansitests.ExtensibleCollectionTest", "test_add_");
	}
	@Test
	public void test_removeAll_() throws Throwable {
		MethodTools.debugTest("st.gravel.ansitests.ExtensibleCollectionTest", "test_removeAll_");
	}
	@Test
	public void test_remove_() throws Throwable {
		MethodTools.debugTest("st.gravel.ansitests.ExtensibleCollectionTest", "test_remove_");
	}
	@Test
	public void test_remove_ifAbsent_() throws Throwable {
		MethodTools.debugTest("st.gravel.ansitests.ExtensibleCollectionTest", "test_remove_ifAbsent_");
	}
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.nifi.web.api.request;

/**
 * Class for parsing long parameters and providing a user friendly error
 * message.
 */
public class LongParameter {

    private static final String INVALID_LONG_MESSAGE = "Unable to parse '%s' as a long value.";

    private Long longValue;

    public LongParameter(String rawLongValue) {
        try {
            longValue = Long.parseLong(rawLongValue);
        } catch (NumberFormatException nfe) {
            throw new IllegalArgumentException(String.format(INVALID_LONG_MESSAGE, rawLongValue));
        }
    }

    public Long getLong() {
        return longValue;
    }
}


text:
/**
 * \file
 *
 * \author Keith Whitwell <keith@tungstengraphics.com>
 *
 * \author Nicolai Haehnle <prefect_@gmx.net>
 */

#include "main/glheader.h"
#include "main/api_arrayelt.h"
#include "main/context.h"
#include "main/simple_list.h"
#include "main/imports.h"
#include "main/extensions.h"
#include "main/bufferobj.h"
#include "main/texobj.h"
#include "main/mfeatures.h"

#include "swrast/swrast.h"
#include "swrast_setup/swrast_setup.h"
#include "vbo/vbo.h"

#include "tnl/tnl.h"
#include "tnl/t_pipeline.h"

#include "drivers/common/driverfuncs.h"
#include "drivers/common/meta.h"

#include "r300_context.h"
#include "radeon_span.h"
#include "r300_blit.h"
#include "r300_cmdbuf.h"
#include "r300_state.h"
#include "r300_tex.h"
#include "r300_emit.h"
#include "r300_render.h"
#include "r300_swtcl.h"
#include "radeon_bocs_wrapper.h"
#include "radeon_buffer_objects.h"
#include "radeon_queryobj.h"

#include "utils.h"
#include "xmlpool.h"		/* for symbolic values of enum-type options */

#define need_GL_VERSION_2_0
#define need_GL_ARB_occlusion_query
#define need_GL_ARB_point_parameters
#define need_GL_ARB_vertex_program
#define need_GL_EXT_blend_equation_separate
#define need_GL_EXT_blend_func_separate
#define need_GL_EXT_blend_minmax
#define need_GL_EXT_framebuffer_blit
#define need_GL_EXT_framebuffer_object
#define need_GL_EXT_fog_coord
#define need_GL_EXT_gpu_program_parameters
#define need_GL_EXT_provoking_vertex
#define need_GL_EXT_secondary_color
#define need_GL_EXT_stencil_two_side
#define need_GL_ATI_separate_stencil
#define need_GL_NV_vertex_program
#define need_GL_OES_EGL_image

#include "main/remap_helper.h"

static const struct dri_extension card_extensions[] = {
  /* *INDENT-OFF* */
  {"GL_ARB_depth_texture",		NULL},
  {"GL_ARB_fragment_program",		NULL},
  {"GL_ARB_occlusion_query",		GL_ARB_occlusion_query_functions},
  {"GL_ARB_multitexture",		NULL},
  {"GL_ARB_point_parameters",		GL_ARB_point_parameters_functions},
  {"GL_ARB_shadow",			NULL},
  {"GL_ARB_shadow_ambient",		NULL},
  {"GL_ARB_texture_border_clamp",	NULL},
  {"GL_ARB_texture_cube_map",		NULL},
  {"GL_ARB_texture_env_add",		NULL},
  {"GL_ARB_texture_env_combine",	NULL},
  {"GL_ARB_texture_env_crossbar",	NULL},
  {"GL_ARB_texture_env_dot3",		NULL},
  {"GL_ARB_texture_mirrored_repeat",	NULL},
  {"GL_ARB_vertex_program",		GL_ARB_vertex_program_functions},
  {"GL_EXT_blend_equation_separate",	GL_EXT_blend_equation_separate_functions},
  {"GL_EXT_blend_func_separate",	GL_EXT_blend_func_separate_functions},
  {"GL_EXT_blend_minmax",		GL_EXT_blend_minmax_functions},
  {"GL_EXT_blend_subtract",		NULL},
  {"GL_EXT_fog_coord",			GL_EXT_fog_coord_functions },
  {"GL_EXT_gpu_program_parameters",     GL_EXT_gpu_program_parameters_functions},
  {"GL_EXT_provoking_vertex",           GL_EXT_provoking_vertex_functions },
  {"GL_EXT_secondary_color", 		GL_EXT_secondary_color_functions},
  {"GL_EXT_shadow_funcs",		NULL},
  {"GL_EXT_stencil_two_side",		GL_EXT_stencil_two_side_functions},
  {"GL_EXT_stencil_wrap",		NULL},
  {"GL_EXT_texture_edge_clamp",		NULL},
  {"GL_EXT_texture_env_combine", 	NULL},
  {"GL_EXT_texture_env_dot3", 		NULL},
  {"GL_EXT_texture_filter_anisotropic",	NULL},
  {"GL_EXT_texture_lod_bias",		NULL},
  {"GL_EXT_texture_mirror_clamp",	NULL},
  {"GL_EXT_texture_rectangle",		NULL},
  {"GL_EXT_texture_sRGB",		NULL},
  {"GL_EXT_vertex_array_bgra",		NULL},
  {"GL_ATI_separate_stencil",		GL_ATI_separate_stencil_functions},
  {"GL_ATI_texture_env_combine3",	NULL},
  {"GL_ATI_texture_mirror_once",	NULL},
  {"GL_MESA_pack_invert",		NULL},
  {"GL_MESA_ycbcr_texture",		NULL},
  {"GL_NV_blend_square",		NULL},
  {"GL_NV_vertex_program",		GL_NV_vertex_program_functions},
#if FEATURE_OES_EGL_image
  {"GL_OES_EGL_image",                  GL_OES_EGL_image_functions },
#endif
  {NULL,				NULL}
  /* *INDENT-ON* */
};

static const struct dri_extension mm_extensions[] = {
  { "GL_EXT_framebuffer_blit",	GL_EXT_framebuffer_blit_functions },
  { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions },
  { NULL, NULL }
};

/**
 * The GL 2.0 functions are needed to make display lists work with
 * functions added by GL_ATI_separate_stencil.
 */
static const struct dri_extension gl_20_extension[] = {
  {"GL_VERSION_2_0",			GL_VERSION_2_0_functions },
};

static const struct tnl_pipeline_stage *r300_pipeline[] = {
	/* Catch any t&l fallbacks
	 */
	&_tnl_vertex_transform_stage,
	&_tnl_normal_transform_stage,
	&_tnl_lighting_stage,
	&_tnl_fog_coordinate_stage,
	&_tnl_texgen_stage,
	&_tnl_texture_transform_stage,
	&_tnl_point_attenuation_stage,
	&_tnl_vertex_program_stage,
	&_tnl_render_stage,
	0,
};

static void r300_get_lock(radeonContextPtr rmesa)
{
	drm_radeon_sarea_t *sarea = rmesa->sarea;

	if (sarea->ctx_owner != rmesa->dri.hwContext) {
		sarea->ctx_owner = rmesa->dri.hwContext;
		if (!rmesa->radeonScreen->kernel_mm)
			radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom);
	}
}

static void r300_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa)
{
    /* please flush pipe do all pending work */
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_SC_SCREENDOOR, 1));
    radeon_cs_write_dword(cs, 0x0);
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_SC_SCREENDOOR, 1));
    radeon_cs_write_dword(cs, 0x00FFFFFF);
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_SC_HYPERZ, 1));
    radeon_cs_write_dword(cs, 0x0);
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_US_CONFIG, 1));
    radeon_cs_write_dword(cs, 0x0);
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_ZB_CNTL, 1));
    radeon_cs_write_dword(cs, 0x0);
    radeon_cs_write_dword(cs, cmdwait(rmesa->radeonScreen, R300_WAIT_3D));
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_RB3D_DSTCACHE_CTLSTAT, 1));
    radeon_cs_write_dword(cs, R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D);
    radeon_cs_write_dword(cs, cmdpacket0(rmesa->radeonScreen,
                                  R300_ZB_ZCACHE_CTLSTAT, 1));
    radeon_cs_write_dword(cs, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE);
    radeon_cs_write_dword(cs, cmdwait(rmesa->radeonScreen,
                               R300_WAIT_3D | R300_WAIT_3D_CLEAN));
}

static void r300_vtbl_pre_emit_atoms(radeonContextPtr radeon)
{
	BATCH_LOCALS(radeon);

	cp_wait(radeon, R300_WAIT_3D | R300_WAIT_3D_CLEAN);
	BEGIN_BATCH_NO_AUTOSTATE(2);
	OUT_BATCH_REGVAL(R300_TX_INVALTAGS, R300_TX_FLUSH);
	END_BATCH();
	end_3d(radeon);
}

static void r300_fallback(struct gl_context *ctx, GLuint bit, GLboolean mode)
{
	r300ContextPtr r300 = R300_CONTEXT(ctx);
	if (mode)
		r300->radeon.Fallback |= bit;
	else
		r300->radeon.Fallback &= ~bit;

	r300SwitchFallback(ctx, R300_FALLBACK_RADEON_COMMON, mode);
}

static void r300_emit_query_finish(radeonContextPtr radeon)
{
	r300ContextPtr r300 = (r300ContextPtr)radeon;
	struct radeon_query_object *query = radeon->query.current;
	BATCH_LOCALS(radeon);

	BEGIN_BATCH_NO_AUTOSTATE(3 * 2 *r300->radeon.radeonScreen->num_gb_pipes + 2);
	switch (r300->radeon.radeonScreen->num_gb_pipes) {
	case 4:
		OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_3);
		OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
		OUT_BATCH_RELOC(0, query->bo, query->curr_offset+3*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
	case 3:
		OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_2);
		OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
		OUT_BATCH_RELOC(0, query->bo, query->curr_offset+2*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
	case 2:
		if (r300->radeon.radeonScreen->chip_family <= CHIP_FAMILY_RV380) {
			OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_3);
		} else {
			OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_1);
		}
		OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
		OUT_BATCH_RELOC(0, query->bo, query->curr_offset+1*sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
	case 1:
	default:
		OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_0);
		OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
		OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
		break;
	}
	OUT_BATCH_REGVAL(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL);
	END_BATCH();
	query->curr_offset += r300->radeon.radeonScreen->num_gb_pipes * sizeof(uint32_t);
	assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
	query->emitted_begin = GL_FALSE;
}

static void rv530_emit_query_finish_single_z(radeonContextPtr radeon)
{
	BATCH_LOCALS(radeon);
	struct radeon_query_object *query = radeon->query.current;

	BEGIN_BATCH_NO_AUTOSTATE(8);
	OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
	OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
	OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
	OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
	END_BATCH();

	query->curr_offset += sizeof(uint32_t);
	assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
	query->emitted_begin = GL_FALSE;
}

static void rv530_emit_query_finish_double_z(radeonContextPtr radeon)
{
	BATCH_LOCALS(radeon);
	struct radeon_query_object *query = radeon->query.current;

	BEGIN_BATCH_NO_AUTOSTATE(14);
	OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0);
	OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
	OUT_BATCH_RELOC(0, query->bo, query->curr_offset, 0, RADEON_GEM_DOMAIN_GTT, 0);
	OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1);
	OUT_BATCH_REGSEQ(R300_ZB_ZPASS_ADDR, 1);
	OUT_BATCH_RELOC(0, query->bo, query->curr_offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0);
	OUT_BATCH_REGVAL(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL);
	END_BATCH();

	query->curr_offset += 2 * sizeof(uint32_t);
	assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE);
	query->emitted_begin = GL_FALSE;
}

static void r300_init_vtbl(radeonContextPtr radeon)
{
	radeon->vtbl.get_lock = r300_get_lock;
	radeon->vtbl.update_viewport_offset = r300UpdateViewportOffset;
	radeon->vtbl.emit_cs_header = r300_vtbl_emit_cs_header;
	radeon->vtbl.swtcl_flush = r300_swtcl_flush;
	radeon->vtbl.pre_emit_atoms = r300_vtbl_pre_emit_atoms;
	radeon->vtbl.fallback = r300_fallback;
	if (radeon->radeonScreen->chip_family == CHIP_FAMILY_RV530) {
		if (radeon->radeonScreen->num_z_pipes == 2)
			radeon->vtbl.emit_query_finish = rv530_emit_query_finish_double_z;
		else
			radeon->vtbl.emit_query_finish = rv530_emit_query_finish_single_z;
	} else
		radeon->vtbl.emit_query_finish = r300_emit_query_finish;

	radeon->vtbl.check_blit = r300_check_blit;
	radeon->vtbl.blit = r300_blit;

	if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
		radeon->vtbl.is_format_renderable = r500IsFormatRenderable;
	} else {
		radeon->vtbl.is_format_renderable = r300IsFormatRenderable;
	}
}

static void r300InitConstValues(struct gl_context *ctx, radeonScreenPtr screen)
{
	r300ContextPtr r300 = R300_CONTEXT(ctx);

	ctx->Const.MaxTextureImageUnits =
	    driQueryOptioni(&r300->radeon.optionCache, "texture_image_units");
	ctx->Const.MaxTextureCoordUnits =
	    driQueryOptioni(&r300->radeon.optionCache, "texture_coord_units");
	ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureImageUnits,
		 ctx->Const.MaxTextureCoordUnits);
	ctx->Const.MaxCombinedTextureImageUnits =
		ctx->Const.MaxVertexTextureImageUnits +
		ctx->Const.MaxTextureImageUnits;

	ctx->Const.MaxTextureMaxAnisotropy = 16.0;
	ctx->Const.MaxTextureLodBias = 16.0;

	if (screen->chip_family >= CHIP_FAMILY_RV515) {
		ctx->Const.MaxTextureLevels = 13;
		ctx->Const.MaxCubeTextureLevels = 13;
		ctx->Const.MaxTextureRectSize = 4096;
		ctx->Const.MaxRenderbufferSize = 4096;
	}
	else {
		ctx->Const.MaxTextureLevels = 12;
		ctx->Const.MaxCubeTextureLevels = 12;
		ctx->Const.MaxTextureRectSize = 2048;
		ctx->Const.MaxRenderbufferSize = 2048;
	}

	ctx->Const.MinPointSize = 1.0;
	ctx->Const.MinPointSizeAA = 1.0;
	ctx->Const.MaxPointSize = R300_POINTSIZE_MAX;
	ctx->Const.MaxPointSizeAA = R300_POINTSIZE_MAX;

	ctx->Const.MinLineWidth = 1.0;
	ctx->Const.MinLineWidthAA = 1.0;
	ctx->Const.MaxLineWidth = R300_LINESIZE_MAX;
	ctx->Const.MaxLineWidthAA = R300_LINESIZE_MAX;

	ctx->Const.MaxDrawBuffers = 1;
	ctx->Const.MaxColorAttachments = 1;

	if (r300->options.hw_tcl_enabled) {
		ctx->Const.VertexProgram.MaxNativeInstructions = 255;
		ctx->Const.VertexProgram.MaxNativeAluInstructions = 255;
		ctx->Const.VertexProgram.MaxNativeAttribs = 16;
		ctx->Const.VertexProgram.MaxNativeTemps = 32;
		ctx->Const.VertexProgram.MaxNativeParameters = 256;
		ctx->Const.VertexProgram.MaxNativeAddressRegs = 1;
	}

	if (screen->chip_family >= CHIP_FAMILY_RV515) {
		ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS;
		ctx->Const.FragmentProgram.MaxNativeAttribs = 11;	/* copy i915... */

		/* The hardware limits are higher than this,
		 * but the non-KMS DRM interface artificially limits us
		 * to this many instructions.
		 *
		 * We could of course work around it in the KMS path,
		 * but it would be a mess, so it seems wiser
		 * to leave it as is. Going forward, the Gallium driver
		 * will not be subject to these limitations.
		 */
		ctx->Const.FragmentProgram.MaxNativeParameters = 255;
		ctx->Const.FragmentProgram.MaxNativeAluInstructions = 255;
		ctx->Const.FragmentProgram.MaxNativeTexInstructions = 255;
		ctx->Const.FragmentProgram.MaxNativeInstructions = 255;
		ctx->Const.FragmentProgram.MaxNativeTexIndirections = 255;
		ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
	} else {
		ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS;
		ctx->Const.FragmentProgram.MaxNativeAttribs = 11;	/* copy i915... */
		ctx->Const.FragmentProgram.MaxNativeParameters = R300_PFS_NUM_CONST_REGS;
		ctx->Const.FragmentProgram.MaxNativeAluInstructions = R300_PFS_MAX_ALU_INST;
		ctx->Const.FragmentProgram.MaxNativeTexInstructions = R300_PFS_MAX_TEX_INST;
		ctx->Const.FragmentProgram.MaxNativeInstructions = R300_PFS_MAX_ALU_INST + R300_PFS_MAX_TEX_INST;
		ctx->Const.FragmentProgram.MaxNativeTexIndirections = R300_PFS_MAX_TEX_INDIRECT;
		ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
	}

}

static void r300ParseOptions(r300ContextPtr r300, radeonScreenPtr screen)
{
	struct r300_options options = { 0 };

	driParseConfigFiles(&r300->radeon.optionCache, &screen->optionCache,
			    screen->driScreen->myNum, "r300");

	r300->radeon.initialMaxAnisotropy = driQueryOptionf(&r300->radeon.optionCache, "def_max_anisotropy");

	options.stencil_two_side_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_stencil_two_side");
	options.s3tc_force_enabled = driQueryOptionb(&r300->radeon.optionCache, "force_s3tc_enable");
	options.s3tc_force_disabled = driQueryOptionb(&r300->radeon.optionCache, "disable_s3tc");

	if (!(screen->chip_flags & RADEON_CHIPSET_TCL) || driQueryOptioni(&r300->radeon.optionCache, "tcl_mode") == DRI_CONF_TCL_SW)
		options.hw_tcl_enabled = 0;
	else
		options.hw_tcl_enabled = 1;

	options.conformance_mode = !driQueryOptionb(&r300->radeon.optionCache, "disable_lowimpact_fallback");

	r300->options = options;
}

static void r300InitGLExtensions(struct gl_context *ctx)
{
	r300ContextPtr r300 = R300_CONTEXT(ctx);

	driInitExtensions(ctx, card_extensions, GL_TRUE);
	if (r300->radeon.radeonScreen->kernel_mm)
		driInitExtensions(ctx, mm_extensions, GL_FALSE);

	if (r300->options.stencil_two_side_disabled)
		_mesa_disable_extension(ctx, "GL_EXT_stencil_two_side");

	if (r300->options.s3tc_force_disabled) {
		_mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc");
	} else if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) {
		_mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc");
		_mesa_enable_extension(ctx, "GL_S3_s3tc");
	}

	if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) {
		_mesa_disable_extension(ctx, "GL_ARB_occlusion_query");
	}
        if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_R420)
  		_mesa_enable_extension(ctx, "GL_ARB_half_float_vertex");

	if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
		_mesa_enable_extension(ctx, "GL_EXT_packed_depth_stencil");
}

static void r300InitIoctlFuncs(struct dd_function_table *functions)
{
	functions->Clear = _mesa_meta_Clear;
	functions->Finish = radeonFinish;
	functions->Flush = radeonFlush;
}

/* Create the device specific rendering context.
 */
GLboolean r300CreateContext(gl_api api,
			    const struct gl_config * glVisual,
			    __DRIcontext * driContextPriv,
			    void *sharedContextPrivate)
{
	__DRIscreen *sPriv = driContextPriv->driScreenPriv;
	radeonScreenPtr screen = (radeonScreenPtr) (sPriv->private);
	struct dd_function_table functions;
	r300ContextPtr r300;
	struct gl_context *ctx;

	assert(glVisual);
	assert(driContextPriv);
	assert(screen);

	r300 = (r300ContextPtr) CALLOC(sizeof(*r300));
	if (!r300)
		return GL_FALSE;

	r300ParseOptions(r300, screen);

	r300->radeon.radeonScreen = screen;
	r300_init_vtbl(&r300->radeon);

	_mesa_init_driver_functions(&functions);
	r300InitIoctlFuncs(&functions);
	r300InitStateFuncs(&r300->radeon, &functions);
	r300InitTextureFuncs(&r300->radeon, &functions);
	r300InitShaderFuncs(&functions);
	radeonInitQueryObjFunctions(&functions);
	radeonInitBufferObjectFuncs(&functions);

	if (!radeonInitContext(&r300->radeon, &functions,
			       glVisual, driContextPriv,
			       sharedContextPrivate)) {
		FREE(r300);
		return GL_FALSE;
	}

	ctx = r300->radeon.glCtx;

	r300->fallback = 0;
	if (r300->options.hw_tcl_enabled)
		ctx->VertexProgram._MaintainTnlProgram = GL_TRUE;

	ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE;

	r300InitConstValues(ctx, screen);

	_mesa_set_mvp_with_dp4( ctx, GL_TRUE );

	/* Initialize the software rasterizer and helper modules.
	 */
	_swrast_CreateContext(ctx);
	_vbo_CreateContext(ctx);
	_tnl_CreateContext(ctx);
	_swsetup_CreateContext(ctx);
	_swsetup_Wakeup(ctx);

	/* Install the customized pipeline:
	 */
	_tnl_destroy_pipeline(ctx);
	_tnl_install_pipeline(ctx, r300_pipeline);
	TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;

	/* Configure swrast and TNL to match hardware characteristics:
	 */
	_swrast_allow_pixel_fog(ctx, GL_FALSE);
	_swrast_allow_vertex_fog(ctx, GL_TRUE);
	_tnl_allow_pixel_fog(ctx, GL_FALSE);
	_tnl_allow_vertex_fog(ctx, GL_TRUE);

	if (r300->options.hw_tcl_enabled) {
		r300InitDraw(ctx);
	} else {
		r300InitSwtcl(ctx);
	}

	r300_blit_init(r300);
	radeon_fbo_init(&r300->radeon);
	radeonInitSpanFuncs( ctx );
	r300InitCmdBuf(r300);
	r300InitState(r300);
	r300InitShaderFunctions(r300);

	r300InitGLExtensions(ctx);

	return GL_TRUE;
}


text:
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.Completion.Providers
Imports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery

Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.ArrayStatements
    ''' <summary>
    ''' Recommends the "ReDim" statement.
    ''' </summary>
    Friend Class ReDimKeywordRecommender
        Inherits AbstractKeywordRecommender

        Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =
            ImmutableArray.Create(New RecommendedKeyword("ReDim", VBFeaturesResources.Reallocates_storage_space_for_an_array_variable))

        Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)
            Return If(context.IsSingleLineStatementContext, s_keywords, ImmutableArray(Of RecommendedKeyword).Empty)
        End Function
    End Class
End Namespace


text:
package jetbrains.jetpad.base.edt;

import org.junit.Test;
import org.mockito.Mockito;

import static org.mockito.Mockito.times;

public class TestEventDispatchThreadTest {
  private TestEventDispatchThread edt = new TestEventDispatchThread();

  @Test
  public void simpleInvokeLater() {
    Runnable r = Mockito.mock(Runnable.class);
    edt.schedule(r);
    edt.executeUpdates();
    Mockito.verify(r).run();
  }

  @Test
  public void invokeLaterWithInvokeLater() {
    final Runnable r = Mockito.mock(Runnable.class);
    edt.schedule(new Runnable() {
      @Override
      public void run() {
        edt.schedule(r);
      }
    });
    edt.executeUpdates();
    Mockito.verify(r).run();
  }

  @Test
  public void simpleInvokeLaterWithDelay() {
    Runnable r = Mockito.mock(Runnable.class);
    edt.schedule(100, r);
    edt.executeUpdates();
    Mockito.verifyZeroInteractions(r);
    edt.executeUpdates(100);
    Mockito.verify(r).run();
  }

  @Test
  public void simpleInvokeLaterRepeating() {
    Runnable r = Mockito.mock(Runnable.class);
    edt.scheduleRepeating(1, r);
    edt.executeUpdates(2);
    Mockito.verify(r, times(2)).run();
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/white" android:state_enabled="true" android:state_pressed="true"/>
    <item android:color="@color/colorPrimary"/>
</selector>


text:
ACCEPTED

#### According to
Interim Register of Marine and Nonmarine Genera

#### Published in
Paleontol Zh 2, Mart-Aprel: 31.

#### Original name
null

### Remarks
null


text:
ALTER TABLE sslconfig
    ADD COLUMN IF NOT EXISTS sslcertificateactiveversion INT4;

-- //@UNDO
-- SQL to undo the change goes here.

ALTER TABLE sslconfig
    DROP COLUMN IF EXISTS sslcertificateactiveversion;


text:
/** \file comstl/internal/interface_traits_std.hpp
 *
 * \brief [C++ only] Contains explicit specialisations of the
 *   comstl::IID_traits traits class, used by compilers that do not
 *   support the Microsoft-specific <code>__uuidof</code> operator
 *   (\ref group__library__utility__com "COM Utility" Library).
 */

#ifndef COMSTL_INCL_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD
#define COMSTL_INCL_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD

#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define COMSTL_VER_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD_MAJOR      3
# define COMSTL_VER_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD_MINOR      1
# define COMSTL_VER_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD_REVISION   5
# define COMSTL_VER_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD_EDIT       44
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/* /////////////////////////////////////////////////////////////////////////
 * Includes
 */

#ifndef COMSTL_INCL_COMSTL_H_COMSTL
# include <comstl/comstl.h>
#endif /* !COMSTL_INCL_COMSTL_H_COMSTL */
#ifndef COMSTL_INCL_COMSTL_UTIL_HPP_INTERFACE_TRAITS
# include <comstl/util/interface_traits.hpp>
#endif /* !COMSTL_INCL_COMSTL_UTIL_HPP_INTERFACE_TRAITS */
#ifndef STLSOFT_INCL_H_OAIDL
# define STLSOFT_INCL_H_OAIDL
# include <oaidl.h>
#endif /* !STLSOFT_INCL_H_OAIDL */

/* /////////////////////////////////////////////////////////////////////////
 * Namespace
 */

#ifndef _COMSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
/* There is no stlsoft namespace, so must define ::comstl */
namespace comstl
{
# else
/* Define stlsoft::comstl_project */

namespace stlsoft
{

namespace comstl_project
{

# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_COMSTL_NO_NAMESPACE */

/* /////////////////////////////////////////////////////////////////////////
 * Classes
 */

/* unknwn.idl */

#if defined(STLSOFT_COMPILER_IS_GCC) && \
    defined(_UNKNWN_H)
# define __IUnknown_FWD_DEFINED__
# define __IClassFactory_FWD_DEFINED__
#endif /* STLSOFT_COMPILER_IS_GCC && _UNKNWN_H */

#ifdef __IUnknown_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IUnknown)
#endif  /* __IUnknown_FWD_DEFINED__ */
#ifdef __IClassFactory_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IClassFactory)
#endif  /* __IClassFactory_FWD_DEFINED__ */

/* oaidl.idl */

#if defined(STLSOFT_COMPILER_IS_GCC) && \
    defined(_UNKNWN_H)
# define __ITypeLib_FWD_DEFINED__
# define __ITypeLib2_FWD_DEFINED__
# define __ICreateTypeInfo_FWD_DEFINED__
# define __ICreateTypeInfo2_FWD_DEFINED__
# define __ICreateTypeLib_FWD_DEFINED__
# define __ICreateTypeLib2_FWD_DEFINED__
# define __ITypeComp_FWD_DEFINED__
# define __ITypeInfo_FWD_DEFINED__
# define __ITypeInfo2_FWD_DEFINED__
# define __IErrorInfo_FWD_DEFINED__
# define __IDispatch_FWD_DEFINED__
# define __IEnumVARIANT_FWD_DEFINED__
# define __ICreateErrorInfo_FWD_DEFINED__
# define __ISupportErrorInfo_FWD_DEFINED__
# define __IRecordInfo_FWD_DEFINED__
#endif /* STLSOFT_COMPILER_IS_GCC && _UNKNWN_H */

#ifdef __ITypeLib_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ITypeLib)
#endif /* __ITypeLib_FWD_DEFINED__ */
#ifdef __ITypeLib2_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ITypeLib2)
#endif /* __ITypeLib2_FWD_DEFINED__ */
#ifdef __ICreateTypeInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ICreateTypeInfo)
#endif /* __ICreateTypeInfo_FWD_DEFINED__ */
#ifdef __ICreateTypeInfo2_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ICreateTypeInfo2)
#endif /* __ICreateTypeInfo2_FWD_DEFINED__ */
#ifdef __ICreateTypeLib_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ICreateTypeLib)
#endif /* __ICreateTypeLib_FWD_DEFINED__ */
#ifdef __ICreateTypeLib2_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ICreateTypeLib2)
#endif /* __ICreateTypeLib2_FWD_DEFINED__ */
#ifdef __ITypeComp_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ITypeComp)
#endif /* __ITypeComp_FWD_DEFINED__ */
#ifdef __ITypeInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ITypeInfo)
#endif /* __ITypeInfo_FWD_DEFINED__ */
#ifdef __ITypeInfo2_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ITypeInfo2)
#endif /* __ITypeInfo2_FWD_DEFINED__ */
#ifdef __IErrorInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IErrorInfo)
#endif /* __IErrorInfo_FWD_DEFINED__ */
#ifdef __IDispatch_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IDispatch)
#endif /* __IDispatch_FWD_DEFINED__ */
#ifdef __IEnumVARIANT_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumVARIANT)
#endif /* __IEnumVARIANT_FWD_DEFINED__ */
#ifdef __ICreateErrorInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ICreateErrorInfo)
#endif /* __ICreateErrorInfo_FWD_DEFINED__ */
#ifdef __ISupportErrorInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ISupportErrorInfo)
#endif /* __ISupportErrorInfo_FWD_DEFINED__ */
#ifdef __IRecordInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRecordInfo)
#endif /* __IRecordInfo_FWD_DEFINED__ */

/* objidl.idl */

#if defined(STLSOFT_COMPILER_IS_GCC) && \
    defined(_UNKNWN_H)
# define __IMarshal_FWD_DEFINED__
# define __IMalloc_FWD_DEFINED__
# define __IMallocSpy_FWD_DEFINED__
# define __IStdMarshalInfo_FWD_DEFINED__
# define __IExternalConnection_FWD_DEFINED__
//# define __IMultiQI_FWD_DEFINED__
# define __IEnumUnknown_FWD_DEFINED__
# define __IBindCtx_FWD_DEFINED__
# define __IEnumMoniker_FWD_DEFINED__
# define __IRunnableObject_FWD_DEFINED__
# define __IRunningObjectTable_FWD_DEFINED__
# define __IPersist_FWD_DEFINED__
# define __IPersistStream_FWD_DEFINED__
# define __IMoniker_FWD_DEFINED__
# define __IROTData_FWD_DEFINED__
# define __IEnumString_FWD_DEFINED__
# define __ISequentialStream_FWD_DEFINED__
# define __IStream_FWD_DEFINED__
# define __IEnumSTATSTG_FWD_DEFINED__
# define __IStorage_FWD_DEFINED__
# define __IPersistFile_FWD_DEFINED__
# define __IPersistStorage_FWD_DEFINED__
# define __ILockBytes_FWD_DEFINED__
# define __IEnumFORMATETC_FWD_DEFINED__
# define __IEnumSTATDATA_FWD_DEFINED__
# define __IRootStorage_FWD_DEFINED__
# define __IAdviseSink_FWD_DEFINED__
# define __IAdviseSink2_FWD_DEFINED__
# define __IDataObject_FWD_DEFINED__
# define __IDataAdviseHolder_FWD_DEFINED__
# define __IMessageFilter_FWD_DEFINED__
# define __IRpcChannelBuffer_FWD_DEFINED__
# define __IRpcProxyBuffer_FWD_DEFINED__
# define __IRpcStubBuffer_FWD_DEFINED__
# define __IPSFactoryBuffer_FWD_DEFINED__
# define __IChannelHook_FWD_DEFINED__
# define __IPropertyStorage_FWD_DEFINED__
# define __IPropertySetStorage_FWD_DEFINED__
# define __IEnumSTATPROPSTG_FWD_DEFINED__
# define __IEnumSTATPROPSETSTG_FWD_DEFINED__
# define __IClientSecurity_FWD_DEFINED__
# define __IServerSecurity_FWD_DEFINED__
# define __IClassActivator_FWD_DEFINED__
# define __IFillLockBytes_FWD_DEFINED__
# define __IProgressNotify_FWD_DEFINED__
# define __ILayoutStorage_FWD_DEFINED__
#endif /* STLSOFT_COMPILER_IS_GCC && _UNKNWN_H */

#ifdef __IMarshal_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMarshal)
#endif  /* __IMarshal_FWD_DEFINED__ */
#ifdef __IMalloc_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMalloc)
#endif  /* __IMalloc_FWD_DEFINED__ */
#ifdef __IMallocSpy_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMallocSpy)
#endif  /* __IMallocSpy_FWD_DEFINED__ */
#ifdef __IStdMarshalInfo_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IStdMarshalInfo)
#endif  /* __IStdMarshalInfo_FWD_DEFINED__ */
#ifdef __IExternalConnection_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IExternalConnection)
#endif  /* __IExternalConnection_FWD_DEFINED__ */
#ifdef __IMultiQI_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMultiQI)
#endif  /* __IMultiQI_FWD_DEFINED__ */
#ifdef __IEnumUnknown_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumUnknown)
#endif  /* __IEnumUnknown_FWD_DEFINED__ */
#ifdef __IBindCtx_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IBindCtx)
#endif  /* __IBindCtx_FWD_DEFINED__ */
#ifdef __IEnumMoniker_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumMoniker)
#endif  /* __IEnumMoniker_FWD_DEFINED__ */
#ifdef __IRunnableObject_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRunnableObject)
#endif  /* __IRunnableObject_FWD_DEFINED__ */
#ifdef __IRunningObjectTable_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRunningObjectTable)
#endif  /* __IRunningObjectTable_FWD_DEFINED__ */
#ifdef __IPersist_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPersist)
#endif  /* __IPersist_FWD_DEFINED__ */
#ifdef __IPersistStream_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPersistStream)
#endif  /* __IPersistStream_FWD_DEFINED__ */
#ifdef __IMoniker_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMoniker)
#endif  /* __IMoniker_FWD_DEFINED__ */
#ifdef __IROTData_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IROTData)
#endif  /* __IROTData_FWD_DEFINED__ */
#ifdef __IEnumString_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumString)
#endif  /* __IEnumString_FWD_DEFINED__ */
#ifdef __ISequentialStream_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ISequentialStream)
#endif  /* __ISequentialStream_FWD_DEFINED__ */
#ifdef __IStream_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IStream)
#endif  /* __IStream_FWD_DEFINED__ */
#ifdef __IEnumSTATSTG_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumSTATSTG)
#endif  /* __IEnumSTATSTG_FWD_DEFINED__ */
#ifdef __IStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IStorage)
#endif  /* __IStorage_FWD_DEFINED__ */
#ifdef __IPersistFile_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPersistFile)
#endif  /* __IPersistFile_FWD_DEFINED__ */
#ifdef __IPersistStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPersistStorage)
#endif  /* __IPersistStorage_FWD_DEFINED__ */
#ifdef __ILockBytes_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ILockBytes)
#endif  /* __ILockBytes_FWD_DEFINED__ */
#ifdef __IEnumFORMATETC_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumFORMATETC)
#endif  /* __IEnumFORMATETC_FWD_DEFINED__ */
#ifdef __IEnumSTATDATA_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumSTATDATA)
#endif  /* __IEnumSTATDATA_FWD_DEFINED__ */
#ifdef __IRootStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRootStorage)
#endif  /* __IRootStorage_FWD_DEFINED__ */
#ifdef __IAdviseSink_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IAdviseSink)
#endif  /* __IAdviseSink_FWD_DEFINED__ */
#ifdef __IAdviseSink2_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IAdviseSink2)
#endif  /* __IAdviseSink2_FWD_DEFINED__ */
#ifdef __IDataObject_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IDataObject)
#endif  /* __IDataObject_FWD_DEFINED__ */
#ifdef __IDataAdviseHolder_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IDataAdviseHolder)
#endif  /* __IDataAdviseHolder_FWD_DEFINED__ */
#ifdef __IMessageFilter_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IMessageFilter)
#endif  /* __IMessageFilter_FWD_DEFINED__ */
#ifdef __IRpcChannelBuffer_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRpcChannelBuffer)
#endif  /* __IRpcChannelBuffer_FWD_DEFINED__ */
#ifdef __IRpcProxyBuffer_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRpcProxyBuffer)
#endif  /* __IRpcProxyBuffer_FWD_DEFINED__ */
#ifdef __IRpcStubBuffer_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IRpcStubBuffer)
#endif  /* __IRpcStubBuffer_FWD_DEFINED__ */
#ifdef __IPSFactoryBuffer_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPSFactoryBuffer)
#endif  /* __IPSFactoryBuffer_FWD_DEFINED__ */
#ifdef __IChannelHook_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IChannelHook)
#endif  /* __IChannelHook_FWD_DEFINED__ */
#ifdef __IPropertyStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPropertyStorage)
#endif  /* __IPropertyStorage_FWD_DEFINED__ */
#ifdef __IPropertySetStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IPropertySetStorage)
#endif  /* __IPropertySetStorage_FWD_DEFINED__ */
#ifdef __IEnumSTATPROPSTG_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumSTATPROPSTG)
#endif  /* __IEnumSTATPROPSTG_FWD_DEFINED__ */
#ifdef __IEnumSTATPROPSETSTG_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IEnumSTATPROPSETSTG)
#endif  /* __IEnumSTATPROPSETSTG_FWD_DEFINED__ */
#ifdef __IClientSecurity_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IClientSecurity)
#endif  /* __IClientSecurity_FWD_DEFINED__ */
#ifdef __IServerSecurity_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IServerSecurity)
#endif  /* __IServerSecurity_FWD_DEFINED__ */
#ifdef __IClassActivator_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IClassActivator)
#endif  /* __IClassActivator_FWD_DEFINED__ */
#ifdef __IFillLockBytes_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IFillLockBytes)
#endif  /* __IFillLockBytes_FWD_DEFINED__ */
#ifdef __IProgressNotify_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(IProgressNotify)
#endif  /* __IProgressNotify_FWD_DEFINED__ */
#ifdef __ILayoutStorage_FWD_DEFINED__
COMSTL_IID_TRAITS_DEFINE(ILayoutStorage)
#endif  /* __ILayoutStorage_FWD_DEFINED__ */

/* ////////////////////////////////////////////////////////////////////// */

#ifndef _COMSTL_NO_NAMESPACE
# if defined(_STLSOFT_NO_NAMESPACE) || \
     defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
} // namespace comstl
# else
} // namespace comstl_project
} // namespace stlsoft
# endif /* _STLSOFT_NO_NAMESPACE */
#endif /* !_COMSTL_NO_NAMESPACE */

/* ////////////////////////////////////////////////////////////////////// */

#endif /* !COMSTL_INCL_COMSTL_INTERNAL_HPP_INTERFACE_TRAITS_STD */

/* ///////////////////////////// end of file //////////////////////////// */


text:
package com.sap.mentors.lemonaid.entities;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="line_of_business")
public class LineOfBusiness {

	public static final String PLATFORM_AND_TECHNOLOGY = "platform_and_technology";
	public static final String ASSET_MANAGEMENT = "asset_management";
	public static final String COMMERCE = "commerce";
	public static final String ERP = "erp";
	public static final String FINANCE = "finance";
	public static final String HUMAN_RESOURCES = "human_resources";
	public static final String MAINTENANCE = "maintenance";
	public static final String MANUFACTURING = "manufacturing";
	public static final String MARKETING = "marketing";
	public static final String ENGINEERING = "engineering";
	public static final String SALES = "sales";
	public static final String SERVICE = "service";
	public static final String SOURCING_AND_PROCUREMENT = "sourcing_and_procurement";
	public static final String SUPPLY_CHAIN = "supply_chain";
	public static final String SUSTAINABILITY = "sustainability";

	@Id
	private String id;
    private String name;

	public LineOfBusiness() {}

    public LineOfBusiness(String id) {
    	this.id = id;
    }

    public LineOfBusiness(String id, String name) {
    	this.id = id;
        this.name = name;
    }

    @Override
    public String toString() {
        return String.format(
                "LineOfBusiness[id=%d, name='%s']",
                id, name);
    }

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

    public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}


text:
// Package install installs the experimental API group, making it available as
// an option to all of the API encoding/decoding machinery.
package install

import (
	"k8s.io/apimachinery/pkg/runtime"
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
	"k8s.io/kubernetes/pkg/api/legacyscheme"
	"k8s.io/kubernetes/pkg/apis/autoscaling"
	"k8s.io/kubernetes/pkg/apis/autoscaling/v1"
	"k8s.io/kubernetes/pkg/apis/autoscaling/v2beta1"
)

func init() {
	Install(legacyscheme.Scheme)
}

// Install registers the API group and adds types to a scheme
func Install(scheme *runtime.Scheme) {
	utilruntime.Must(autoscaling.AddToScheme(scheme))
	utilruntime.Must(v2beta1.AddToScheme(scheme))
	utilruntime.Must(v1.AddToScheme(scheme))
	utilruntime.Must(scheme.SetVersionPriority(v1.SchemeGroupVersion, v2beta1.SchemeGroupVersion))
}


text:
from AutoDoApp.parser.Parser import Parser
from AutoDoApp.generator.Generator import Generator
from AutoDoApp.Manager import ManagerThread
from django.test import TestCase
from django.conf import settings
import os
import stat

class IntegrationTestCase(TestCase):

    def setUp(self):
        self.p = Parser()
        self.g = Generator()
        self.test_git_url = "https://github.com/JunoJunho/AutoDoTestApp"
        self.result = self.p.parse_project(self.test_git_url)
        self.project_description = "Test description"
        self.g.generate_document(data=self.result[0],
                                 name=self.result[1],
                                 raw_api=self.result[2],
                                 desc=self.project_description,
                                 licen=self.result[4],
                                 req=self.result[3])
        self.result_directory = os.path.join(settings.BASE_DIR, "parsing_result")
        self.project_name = "AutoDoTestApp"
        self.git_directory = os.path.join(settings.BASE_DIR, "git_project")
        self.file_loc = os.path.join(self.result_directory, self.project_name)

    def test_graph_file_is_generated(self):
        self.assertTrue(os.path.exists(self.file_loc + ".png"))

    def test_read_me_is_generated(self):
        self.assertTrue(os.path.exists(self.file_loc + ".md"))


text:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { PodcastDeckComponent } from './podcast-deck.component';

describe('PodcastDeckComponent', () => {
  let component: PodcastDeckComponent;
  let fixture: ComponentFixture<PodcastDeckComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ PodcastDeckComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(PodcastDeckComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
<component name="libraryTable">
  <library name="Maven: io.undertow:undertow-websockets-jsr:1.3.25.Final">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/io/undertow/undertow-websockets-jsr/1.3.25.Final/undertow-websockets-jsr-1.3.25.Final.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/io/undertow/undertow-websockets-jsr/1.3.25.Final/undertow-websockets-jsr-1.3.25.Final-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/io/undertow/undertow-websockets-jsr/1.3.25.Final/undertow-websockets-jsr-1.3.25.Final-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
#include <internal/thread_arch.h>

#if defined(OPENSSL_THREADS_POSIX)
# define _GNU_SOURCE
# include <errno.h>
# include <sys/types.h>
# include <unistd.h>

static void *thread_start_thunk(void *vthread)
{
    CRYPTO_THREAD *thread;
    CRYPTO_THREAD_RETVAL ret;

    thread = (CRYPTO_THREAD *)vthread;

    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
    pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);

    ret = thread->routine(thread->data);
    ossl_crypto_mutex_lock(thread->statelock);
    CRYPTO_THREAD_SET_STATE(thread, CRYPTO_THREAD_FINISHED);
    thread->retval = ret;
    ossl_crypto_condvar_broadcast(thread->condvar);
    ossl_crypto_mutex_unlock(thread->statelock);

    return NULL;
}

int ossl_crypto_thread_native_spawn(CRYPTO_THREAD *thread)
{
    int ret;
    pthread_attr_t attr;
    pthread_t *handle;

    handle = OPENSSL_zalloc(sizeof(*handle));
    if (handle == NULL)
        goto fail;

    pthread_attr_init(&attr);
    if (!thread->joinable)
        pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
    ret = pthread_create(handle, &attr, thread_start_thunk, thread);
    pthread_attr_destroy(&attr);

    if (ret != 0)
        goto fail;

    thread->handle = handle;
    return 1;

fail:
    thread->handle = NULL;
    OPENSSL_free(handle);
    return 0;
}

int ossl_crypto_thread_native_perform_join(CRYPTO_THREAD *thread, CRYPTO_THREAD_RETVAL *retval)
{
    void *thread_retval;
    pthread_t *handle;

    if (thread == NULL || thread->handle == NULL)
        return 0;

    handle = (pthread_t *) thread->handle;
    if (pthread_join(*handle, &thread_retval) != 0)
        return 0;

    /*
     * Join return value may be non-NULL when the thread has been cancelled,
     * as indicated by thread_retval set to PTHREAD_CANCELLED.
     */
    if (thread_retval != NULL)
        return 0;

    return 1;
}

int ossl_crypto_thread_native_exit(void)
{
    pthread_exit(NULL);
    return 1;
}

int ossl_crypto_thread_native_is_self(CRYPTO_THREAD *thread)
{
    return pthread_equal(*(pthread_t *)thread->handle, pthread_self());
}

CRYPTO_MUTEX *ossl_crypto_mutex_new(void)
{
    pthread_mutex_t *mutex;

    if ((mutex = OPENSSL_zalloc(sizeof(*mutex))) == NULL)
        return NULL;
    if (pthread_mutex_init(mutex, NULL) != 0) {
        OPENSSL_free(mutex);
        return NULL;
    }
    return (CRYPTO_MUTEX *)mutex;
}

int ossl_crypto_mutex_try_lock(CRYPTO_MUTEX *mutex)
{
    pthread_mutex_t *mutex_p;

    mutex_p = (pthread_mutex_t *)mutex;

    if (pthread_mutex_trylock(mutex_p) == EBUSY)
        return 0;

    return 1;
}

void ossl_crypto_mutex_lock(CRYPTO_MUTEX *mutex)
{
    pthread_mutex_t *mutex_p;

    mutex_p = (pthread_mutex_t *)mutex;
    pthread_mutex_lock(mutex_p);
}

void ossl_crypto_mutex_unlock(CRYPTO_MUTEX *mutex)
{
    pthread_mutex_t *mutex_p;

    mutex_p = (pthread_mutex_t *)mutex;
    pthread_mutex_unlock(mutex_p);
}

void ossl_crypto_mutex_free(CRYPTO_MUTEX **mutex)
{
    pthread_mutex_t **mutex_p;

    if (mutex == NULL)
        return;

    mutex_p = (pthread_mutex_t **)mutex;
    if (*mutex_p != NULL)
        pthread_mutex_destroy(*mutex_p);
    OPENSSL_free(*mutex_p);
    *mutex = NULL;
}

CRYPTO_CONDVAR *ossl_crypto_condvar_new(void)
{
    pthread_cond_t *cv_p;

    if ((cv_p = OPENSSL_zalloc(sizeof(*cv_p))) == NULL)
        return NULL;
    if (pthread_cond_init(cv_p, NULL) != 0) {
        OPENSSL_free(cv_p);
        return NULL;
    }
    return (CRYPTO_CONDVAR *) cv_p;
}

void ossl_crypto_condvar_wait(CRYPTO_CONDVAR *cv, CRYPTO_MUTEX *mutex)
{
    pthread_cond_t *cv_p;
    pthread_mutex_t *mutex_p;

    cv_p = (pthread_cond_t *)cv;
    mutex_p = (pthread_mutex_t *)mutex;
    pthread_cond_wait(cv_p, mutex_p);
}

void ossl_crypto_condvar_broadcast(CRYPTO_CONDVAR *cv)
{
    pthread_cond_t *cv_p;

    cv_p = (pthread_cond_t *)cv;
    pthread_cond_broadcast(cv_p);
}

void ossl_crypto_condvar_free(CRYPTO_CONDVAR **cv)
{
    pthread_cond_t **cv_p;

    if (cv == NULL)
        return;

    cv_p = (pthread_cond_t **)cv;
    if (*cv_p != NULL)
        pthread_cond_destroy(*cv_p);
    OPENSSL_free(*cv_p);
    *cv_p = NULL;
}

void ossl_crypto_mem_barrier(void)
{
# if defined(__clang__) || defined(__GNUC__)
    __sync_synchronize();
# elif !defined(OPENSSL_NO_ASM)
#  if defined(__alpha__) /* Alpha */
    __asm__ volatile("mb" : : : "memory");
#  elif defined(__amd64__) || defined(__i386__) || defined(__i486__) \
    || defined(__i586__)  || defined(__i686__) || defined(__i386) /* x86 */
    __asm__ volatile("mfence" : : : "memory");
#  elif defined(__arm__) || defined(__aarch64__) /* ARMv7, ARMv8 */
    __asm__ volatile("dmb ish" : : : "memory");
#  elif defined(__hppa__) /* PARISC */
    __asm__ volatile("" : : : "memory");
#  elif defined(__mips__) /* MIPS */
    __asm__ volatile("sync" : : : "memory");
#  elif defined(__powerpc__) || defined(__powerpc64__) /* power, ppc64, ppc64le */
    __asm__ volatile("sync" : : : "memory");
#  elif defined(__sparc__)
    __asm__ volatile("ba,pt	%%xcc, 1f\n\t" \
                     " membar	#Sync\n"   \
                     "1:\n"                \
                     : : : "memory");
#  elif defined(__s390__) || defined(__s390x__) /* z */
    __asm__ volatile("bcr 15,0" : : : "memory");
#  elif defined(__riscv) || defined(__riscv__) /* riscv */
    __asm__ volatile("fence iorw,iorw" : : : "memory");
#  else /* others, compiler only */
    __asm__ volatile("" : : : "memory");
#  endif
# else
    /* compiler only barrier */
    __asm__ volatile("" : : : "memory");
# endif
}

#endif


text:
/**
 * (c) 2014 Vincenzo Cappello
 * This projected is licensed under the terms of the MIT license,
 * refer to the file LICENSE.txt.
 */

#ifndef WIN_POINT_H
#define WIN_POINT_H

namespace win {

// TODO: move from here! put on win32?
class Point {
public:
	Point() {}
	Point(int x, int y) :
		x( x ),
		y( y ) {}
	~Point() {}

	int x;
	int y;
};

}

#endif // WIN_POINT_H


text:
layout: project
title: restclient-cpp
---
# REST client for C++
[![Build Status](https://travis-ci.org/mrtazz/restclient-cpp.svg?branch=master)](https://travis-ci.org/mrtazz/restclient-cpp)
[![Coverage Status](https://coveralls.io/repos/mrtazz/restclient-cpp/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrtazz/restclient-cpp?branch=master)
[![Packagecloud](https://img.shields.io/badge/packagecloud-available-brightgreen.svg)](https://packagecloud.io/mrtazz/restclient-cpp)
[![doxygen](https://img.shields.io/badge/doxygen-reference-blue.svg)](http://code.mrtazz.com/restclient-cpp/ref/)
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)

## About
This is a simple REST client for C++. It wraps [libcurl][] for HTTP requests.

## Usage
restclient-cpp provides two ways of interacting with REST endpoints. There is
a simple one, which doesn't need you to configure an object to interact with
an API. However the simple way doesn't provide a lot of configuration options
either. So if you need more than just a simple HTTP call, you will probably
want to check out the advanced usage.

### Simple Usage
The simple API is just some static methods modeled after the most common HTTP
verbs:

```cpp
#include "restclient-cpp/restclient.h"

RestClient::Response r = RestClient::get("http://url.com")
RestClient::Response r = RestClient::post("http://url.com/post", "text/json", "{\"foo\": \"bla\"}")
RestClient::Response r = RestClient::put("http://url.com/put", "text/json", "{\"foo\": \"bla\"}")
RestClient::Response r = RestClient::del("http://url.com/delete")
RestClient::Response r = RestClient::head("http://url.com")
```

The response is of type [RestClient::Response][restclient_response] and has
three attributes:

```cpp
RestClient::Response.code // HTTP response code
RestClient::Response.body // HTTP response body
RestClient::Response.headers // HTTP response headers
```

### Advanced Usage
However if you want more sophisticated features like connection reuse,
timeouts or authentication, there is also a different, more configurable way.

```cpp
#include "restclient-cpp/connection.h"
#include "restclient-cpp/restclient.h"

// initialize RestClient
RestClient::init();

// get a connection object
RestClient::Connection* conn = new RestClient::Connection("http://url.com");

// configure basic auth
conn->SetBasicAuth("WarMachine68", "WARMACHINEROX");

// set connection timeout to 5s
conn->SetTimeout(5);

// set custom user agent
// (this will result in the UA "foo/cool restclient-cpp/VERSION")
conn->SetUserAgent("foo/cool");

// enable following of redirects (default is off)
conn->FollowRedirects(true);

// set headers
RestClient::HeaderFields headers;
headers["Accept"] = "application/json";
conn->SetHeaders(headers)

// append additional headers
conn->AppendHeader("X-MY-HEADER", "foo")

// if using a non-standard Certificate Authority (CA) trust file
conn->SetCAInfoFilePath("/etc/custom-ca.crt")

RestClient::Response r = conn->get("/get")
RestClient::Response r = conn->head("/get")
RestClient::Response r = conn->del("/delete")

// set different content header for POST and PUT
conn->AppendHeader("Content-Type", "text/json")
RestClient::Response r = conn->post("/post", "{\"foo\": \"bla\"}")
RestClient::Response r = conn->put("/put", "text/json", "{\"foo\": \"bla\"}")

// deinit RestClient. After calling this you have to call RestClient::init()
// again before you can use it
RestClient::disable();
```

The responses are again of type [RestClient::Response][restclient_response]
and have three attributes:

```cpp
RestClient::Response.code // HTTP response code
RestClient::Response.body // HTTP response body
RestClient::Response.headers // HTTP response headers
```

The connection object also provides a simple way to get some diagnostics and
metrics information via `conn->GetInfo()`. The result is a
`RestClient::Connection::Info` struct and looks like this:

```cpp
typedef struct {
  std::string base_url;
  RestClients::HeaderFields headers;
  int timeout;
  struct {
    std::string username;
    std::string password;
  } basicAuth;

  std::string certPath;
  std::string certType;
  std::string keyPath;
  std::string customUserAgent;
  struct {
    // total time of the last request in seconds Total time of previous
    // transfer. See CURLINFO_TOTAL_TIME
    int totalTime;
    // time spent in DNS lookup in seconds Time from start until name
    // resolving completed. See CURLINFO_NAMELOOKUP_TIME
    int nameLookupTime;
    // time it took until Time from start until remote host or proxy
    // completed. See CURLINFO_CONNECT_TIME
    int connectTime;
    // Time from start until SSL/SSH handshake completed. See
    // CURLINFO_APPCONNECT_TIME
    int appConnectTime;
    // Time from start until just before the transfer begins. See
    // CURLINFO_PRETRANSFER_TIME
    int preTransferTime;
    // Time from start until just when the first byte is received. See
    // CURLINFO_STARTTRANSFER_TIME
    int startTransferTime;
    // Time taken for all redirect steps before the final transfer. See
    // CURLINFO_REDIRECT_TIME
    int redirectTime;
    // number of redirects followed. See CURLINFO_REDIRECT_COUNT
    int redirectCount;
  } lastRequest;
} Info;
```

#### Persistent connections/Keep-Alive
The connection object stores the curl easy handle in an instance variable and
uses that for the lifetime of the object. This means curl will [automatically
reuse connections][curl_keepalive] made with that handle.

## Thread Safety
restclient-cpp leans heavily on libcurl as it aims to provide a thin wrapper
around it. This means it adheres to the basic level of thread safety [provided
by libcurl][curl_threadsafety]. The `RestClient::init()` and
`RestClient::disable()` methods basically correspond to `curl_global_init` and
`curl_global_cleanup` and thus need to be called right at the beginning of
your program and before shutdown respectively. These set up the environment
and are **not thread-safe**. After that you can create connection objects in
your threads. Do not share connection objects across threads as this would
mean accessing curl handles from multiple threads at the same time which is
not allowed.

In order to provide an easy to use API, the simple usage via the static
methods implicitly calls the curl global functions and is therefore also **not
thread-safe**.

## HTTPS User Certificate

Simple wrapper functions are provided to allow clients to authenticate using certificates.
Under the hood these wrappers set cURL options, e.g. `CURLOPT_SSLCERT`, using `curl_easy_setopt`.
Note: currently `libcurl` compiled with `gnutls` (e.g. `libcurl4-gnutls-dev` on
ubuntu) is buggy in that it returns a wrong error code when these options are set to invalid values.

```cpp
// set CURLOPT_SSLCERT
conn->SetCertPath(certPath);
// set CURLOPT_SSLCERTTYPE
conn->SetCertType(type);
// set CURLOPT_SSLKEY
conn->SetKeyPath(keyPath);
```

## Dependencies
- [libcurl][]

## Installation
There are some packages available for Linux on [packagecloud][packagecloud].
And for OSX you can get it from the mrtazz/oss homebrew tap:

```bash
brew tap mrtazz/oss
brew install restclient-cpp
```

Otherwise you can do the regular autotools dance:

```bash
./autogen.sh
./configure
make install
```

## Contribute
All contributions are highly appreciated. This includes filing issues,
updating documentation and writing code. Please take a look at the
[contributing guidelines][contributing] before so your contribution can be
merged as fast as possible.

[libcurl]: http://curl.haxx.se/libcurl/
[gtest]: http://code.google.com/p/googletest/
[packagecloud]: https://packagecloud.io/mrtazz/restclient-cpp
[contributing]: https://github.com/mrtazz/restclient-cpp/blob/master/CONTRIBUTING.md
[curl_keepalive]: http://curl.haxx.se/docs/faq.html#What_about_Keep_Alive_or_persist
[curl_threadsafety]: http://curl.haxx.se/libcurl/c/threadsafe.html
[restclient_response]: http://code.mrtazz.com/restclient-cpp/ref/struct_rest_client_1_1_response.html


text:
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>establishment</type>
  <type>point_of_interest</type>
  <type>school</type>
  <formatted_address>65 W Greenbrook Rd, Caldwell, NJ 07006, USA</formatted_address>
  <address_component>
   <long_name>65</long_name>
   <short_name>65</short_name>
   <type>street_number</type>
  </address_component>
  <address_component>
   <long_name>West Greenbrook Road</long_name>
   <short_name>W Greenbrook Rd</short_name>
   <type>route</type>
  </address_component>
  <address_component>
   <long_name>Caldwell</long_name>
   <short_name>Caldwell</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Essex County</long_name>
   <short_name>Essex County</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>New Jersey</long_name>
   <short_name>NJ</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>United States</long_name>
   <short_name>US</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>07006</long_name>
   <short_name>07006</short_name>
   <type>postal_code</type>
  </address_component>
  <geometry>
   <location>
    <lat>40.8745058</lat>
    <lng>-74.2694532</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>40.8731568</lat>
     <lng>-74.2708022</lng>
    </southwest>
    <northeast>
     <lat>40.8758548</lat>
     <lng>-74.2681042</lng>
    </northeast>
   </viewport>
  </geometry>
  <place_id>ChIJdWNq0v0Aw4kRSOQUNuKNrfI</place_id>
 </result>
</GeocodeResponse>


text:
apns-enhanced-for-erlang
========================
Apple Push Notification Server with Enhanced Binary Interface for Erlang by JPush (http://jpush.cn). If you get any questions, you can send me an email to <iamzhanghu AT gmail.com>.

## Yunba 环境快速启动 & 测试

```
$ ./rebar compile && erl -pa ebin/ -pa deps/*/ebin/ -s apns

3> apns_mq_handler:test_package_from_mq(<<"你好10"/utf8>>).
```

HOWTO
=====
1. Put the certificate at rel/apns/certs/ in format <appkey>_[1|2].pem. 1 - development, 2 - product
2. make run
3. Send test messages by ./test_data.sh localhost 2222. Make sure to change the
CORRECT_DEVICE_TOKEN to your own device token.

Open Source
===========
For developing a quick prototype, some codes are copied from following projects.
https://github.com/inaka/apns4erl.git
https://code.google.com/p/erl-generic-otp-tcp-server-framework/
http://hg.rabbitmq.com/rabbitmq-server/


text:
<?php

/**
 * HttpInvalidInputException class Tests
 *
 * @group App
 */
class Tests_HttpInvalidInputException extends \TestCase
{
	/**
	* @expectedException HttpInvalidInputException
	* @expectedExceptionMessage Invalid input data
	*/
	public function test_exception()
	{
		throw new \HttpInvalidInputException('Invalid input data');
	}
}

/* End of file app/tests/httpinvalidinputexception_Test.php */


text:
<?php

namespace OSC\Apps\PayPal\PayPal\Sites\Admin\Pages\Home\Actions\RPC;

use OSC\OM\HTTP;

class GetNews extends \OSC\OM\PagesActionsAbstract
{
    public function execute()
    {
        $result = [
            'rpcStatus' => -1
        ];

        $response = @json_decode(HTTP::getResponse([
            'url' => 'http://www.oscommerce.com/index.php?RPC&Website&Index&GetPartnerBanner&forumid=105&onlyjson=true'
        ]), true);

        if (is_array($response) && isset($response['title'])) {
            $result = $response;

            $result['rpcStatus'] = 1;
        }

        echo json_encode($result);
    }
}


text:
package org.ovirt.engine.core.common.queries;

import javax.validation.constraints.NotNull;

public class ServerParameters extends VdcQueryParametersBase {
    private static final long serialVersionUID = -3121291409184710688L;

    @NotNull(message="VALIDATION.VDS.HOSTNAME.HOSTNAME_OR_IP")
    private String server;

    public ServerParameters() {
    }

    public ServerParameters(String server) {
        this.server = server;
    }

    public String getServer() {
        return server;
    }

}


text:
(function () {
    "use strict";
    angular.module('hippo.essentials')
        .controller('restServicesCtrl', function ($scope, $sce, $log, $rootScope, $http) {
            $scope.endpoint = $rootScope.REST.dynamic + 'restservices/';
            $scope.resultMessages = [];
            $scope.restType = null;
            $scope.selectedType = "Choose REST type";
            $scope.restName = "restapi";
            $scope.showDocuments = false;
            $scope.documentTypes = [];

            $scope.onChangeRestName = function () {
                updateEndPoints();
            };
            $scope.onChangeType = function (restType) {
                $scope.restType = restType;
                if (restType == 'plain') {
                    // fetch documents:
                    $http.get($rootScope.REST.documents).success(function (data) {
                        $scope.documentTypes = [];
                        angular.forEach(data, function (docType) {
                            if (docType.fullPath) {
                                $scope.documentTypes.push(docType);
                            }
                        });
                        updateEndPoints();
                    });
                } else {
                    $scope.documentTypes = [];
                }
            };
            $scope.checked = function (item) {
                var valid = checkValid();
                if (!valid) {
                } else {
                    $scope.restForm.myDocument.$setValidity("checked", true);
                }
            };
            $scope.runRestSetup = function () {
                // check if we have selected documents:
                if ($scope.restType == 'plain') {
                    var valid = checkValid();
                    if (!valid) {
                        $scope.restForm.myDocument.$setValidity("checked", false);
                        displayError("Please select at least one document type");
                        return;
                    }
                }

                var files = [];
                angular.forEach($scope.documentTypes, function (value) {
                    if (value.checked && value.fullPath) {
                        files.push(value.fullPath);
                    }
                });
                var fileString = files.join(',');
                var payload = Essentials.addPayloadData("restName", $scope.restName, null);
                Essentials.addPayloadData("restType", $scope.restType, payload);
                Essentials.addPayloadData("javaFiles", fileString, payload);
                $http.post($scope.endpoint, payload).success(function (data) {
                    // TODO: display reboot message and instruction sets executed
                });
            };
            //############################################
            // UTIL
            //############################################
            function displayError(msg) {
                $rootScope.feedbackMessages.push({type: 'error', message: msg});
            }

            function checkValid() {
                var valid = false;
                angular.forEach($scope.documentTypes, function (value) {
                    if (value.checked) {
                        valid = true;
                    }
                });
                return valid;
            }
            function updateEndPoints() {
                angular.forEach($scope.documentTypes, function (docType) {
                    if (docType.javaName) {
                        docType.endpoint = "http://localhost:8080/site/"
                                + $scope.restName + "/" + docType.javaName.split('.')[0] + '/';
                    }
                });
            }
        })
})();


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp">

    <TextView
        android:id="@+id/invite_firends_access_key"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAlignment="center"
        android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</LinearLayout>


text: export { default } from 'ember-bootstrap/components/base/bs-dropdown/menu/item';


text:
#ifndef ResourceTimingInfo_h
#define ResourceTimingInfo_h

#include "platform/CrossThreadCopier.h"
#include "platform/network/ResourceRequest.h"
#include "platform/network/ResourceResponse.h"
#include "wtf/Allocator.h"
#include "wtf/Functional.h"
#include "wtf/Noncopyable.h"
#include "wtf/PtrUtil.h"
#include "wtf/text/AtomicString.h"
#include <memory>

namespace blink {

struct CrossThreadResourceTimingInfoData;

class PLATFORM_EXPORT ResourceTimingInfo {
  USING_FAST_MALLOC(ResourceTimingInfo);
  WTF_MAKE_NONCOPYABLE(ResourceTimingInfo);

 public:
  static std::unique_ptr<ResourceTimingInfo> create(const AtomicString& type,
                                                    const double time,
                                                    bool isMainResource) {
    return WTF::wrapUnique(new ResourceTimingInfo(type, time, isMainResource));
  }
  static std::unique_ptr<ResourceTimingInfo> adopt(
      std::unique_ptr<CrossThreadResourceTimingInfoData>);

  // Gets a copy of the data suitable for passing to another thread.
  std::unique_ptr<CrossThreadResourceTimingInfoData> copyData() const;

  double initialTime() const { return m_initialTime; }
  bool isMainResource() const { return m_isMainResource; }

  void setInitiatorType(const AtomicString& type) { m_type = type; }
  const AtomicString& initiatorType() const { return m_type; }

  void setOriginalTimingAllowOrigin(
      const AtomicString& originalTimingAllowOrigin) {
    m_originalTimingAllowOrigin = originalTimingAllowOrigin;
  }
  const AtomicString& originalTimingAllowOrigin() const {
    return m_originalTimingAllowOrigin;
  }

  void setLoadFinishTime(double time) { m_loadFinishTime = time; }
  double loadFinishTime() const { return m_loadFinishTime; }

  void setInitialURL(const KURL& url) { m_initialURL = url; }
  const KURL& initialURL() const { return m_initialURL; }

  void setFinalResponse(const ResourceResponse& response) {
    m_finalResponse = response;
  }
  const ResourceResponse& finalResponse() const { return m_finalResponse; }

  void addRedirect(const ResourceResponse& redirectResponse, bool crossOrigin);
  const Vector<ResourceResponse>& redirectChain() const {
    return m_redirectChain;
  }

  void addFinalTransferSize(long long encodedDataLength) {
    m_transferSize += encodedDataLength;
  }
  long long transferSize() const { return m_transferSize; }

  void clearLoadTimings() {
    m_finalResponse.setResourceLoadTiming(nullptr);
    for (ResourceResponse& redirect : m_redirectChain)
      redirect.setResourceLoadTiming(nullptr);
  }

 private:
  ResourceTimingInfo(const AtomicString& type,
                     const double time,
                     bool isMainResource)
      : m_type(type),
        m_initialTime(time),
        m_transferSize(0),
        m_isMainResource(isMainResource),
        m_hasCrossOriginRedirect(false) {}

  AtomicString m_type;
  AtomicString m_originalTimingAllowOrigin;
  double m_initialTime;
  double m_loadFinishTime;
  KURL m_initialURL;
  ResourceResponse m_finalResponse;
  Vector<ResourceResponse> m_redirectChain;
  long long m_transferSize;
  bool m_isMainResource;
  bool m_hasCrossOriginRedirect;
};

struct CrossThreadResourceTimingInfoData {
  WTF_MAKE_NONCOPYABLE(CrossThreadResourceTimingInfoData);
  USING_FAST_MALLOC(CrossThreadResourceTimingInfoData);

 public:
  CrossThreadResourceTimingInfoData() {}

  String m_type;
  String m_originalTimingAllowOrigin;
  double m_initialTime;
  double m_loadFinishTime;
  KURL m_initialURL;
  std::unique_ptr<CrossThreadResourceResponseData> m_finalResponse;
  Vector<std::unique_ptr<CrossThreadResourceResponseData>> m_redirectChain;
  long long m_transferSize;
  bool m_isMainResource;
};

template <>
struct CrossThreadCopier<ResourceTimingInfo> {
  typedef WTF::PassedWrapper<std::unique_ptr<CrossThreadResourceTimingInfoData>>
      Type;
  static Type copy(const ResourceTimingInfo& info) {
    return WTF::passed(info.copyData());
  }
};

}  // namespace blink

#endif


text:
fg.directive('fgEditPalette',function () {
  return {
    require: ['^fgSchema'],
    templateUrl: 'angular-form-gen/edit/palette/palette.ng.html',
    controller: 'fgEditPaletteController',
    link: function($scope, $element, $attrs, ctrls) {
      $scope.schemaCtrl = ctrls[0];
    }
  };
});


text:
package org.onosproject.lisp.msg.types.lcaf;

import io.netty.buffer.ByteBuf;
import org.onosproject.lisp.msg.exceptions.LispParseError;
import org.onosproject.lisp.msg.exceptions.LispReaderException;
import org.onosproject.lisp.msg.exceptions.LispWriterException;
import org.onosproject.lisp.msg.types.LispAddressReader;
import org.onosproject.lisp.msg.types.LispAddressWriter;
import org.onosproject.lisp.msg.types.LispAfiAddress;

import java.util.Objects;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Nonce locator data type LCAF address class.
 *

 * Nonce locator data type is defined in draft-ietf-lisp-lcaf-22
 * https://tools.ietf.org/html/draft-ietf-lisp-lcaf-22#page-30
 *

 *

 * {@literal
 *  0                   1                   2                   3
 *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |           AFI = 16387         |     Rsvd1     |     Flags     |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |   Type = 8    |     Rsvd2     |             Length            |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |   Reserved    |                  Nonce                        |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * |              AFI = x          |         Address  ...          |
 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
 * }

 */
public final class LispNonceLcafAddress extends LispLcafAddress {

    private final int nonce;
    private final LispAfiAddress address;

    /**
     * Initializes nonce locator data type LCAF address.
     *
     * @param nonce   nonce
     * @param address address
     */
    private LispNonceLcafAddress(int nonce, LispAfiAddress address) {
        super(LispCanonicalAddressFormatEnum.NONCE);
        this.nonce = nonce;
        this.address = address;
    }

    /**
     * Obtains nonce.
     *
     * @return nonce
     */
    public int getNonce() {
        return nonce;
    }

    /**
     * Obtains address.
     *
     * @return address
     */
    public LispAfiAddress getAddress() {
        return address;
    }

    @Override
    public int hashCode() {
        return Objects.hash(nonce, address);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (obj instanceof LispNonceLcafAddress) {
            final LispNonceLcafAddress other = (LispNonceLcafAddress) obj;
            return Objects.equals(this.nonce, other.nonce) &&
                    Objects.equals(this.address, other.address);
        }
        return false;
    }

    @Override
    public String toString() {
        return toStringHelper(this)
                .add("nonce", nonce)
                .add("address", address)
                .toString();
    }

    public static final class NonceAddressBuilder
                        extends LcafAddressBuilder<NonceAddressBuilder> {
        private int nonce;
        private LispAfiAddress address;

        /**
         * Sets nonce.
         *
         * @param nonce nonce
         * @return NonceAddressBuilder object
         */
        public NonceAddressBuilder withNonce(int nonce) {
            this.nonce = nonce;
            return this;
        }

        /**
         * Sets address.
         *
         * @param address address
         * @return NonceAddressBuilder object
         */
        public NonceAddressBuilder withAddress(LispAfiAddress address) {
            this.address = address;
            return this;
        }

        /**
         * Builds LispNonceLcafAddress instance.
         *
         * @return LispNonceLcafAddress instance
         */
        public LispNonceLcafAddress build() {

            checkNotNull(address, "Must specify an address");

            return new LispNonceLcafAddress(nonce, address);
        }
    }

    /**
     * Nonce LCAF address reader class.
     */
    public static class NonceLcafAddressReader
                        implements LispAddressReader<LispNonceLcafAddress> {

        private static final int NONCE_SHIFT_BIT = 16;
        private static final int RESERVED_SKIP_LENGTH = 1;

        @Override
        public LispNonceLcafAddress readFrom(ByteBuf byteBuf)
                                    throws LispParseError, LispReaderException {

            deserializeCommon(byteBuf);

            byteBuf.skipBytes(RESERVED_SKIP_LENGTH);

            // nonce -> 24 bits
            int nonceFirst = byteBuf.readShort() << NONCE_SHIFT_BIT;
            int nonceSecond = byteBuf.readInt();
            int nonce = nonceFirst + nonceSecond;

            LispAfiAddress address = new AfiAddressReader().readFrom(byteBuf);

            return new NonceAddressBuilder()
                            .withNonce(nonce)
                            .withAddress(address)
                            .build();
        }
    }

    /**
     * Nonce LCAF address writer class.
     */
    public static class NonceLcafAddressWriter
                        implements LispAddressWriter<LispNonceLcafAddress> {

        private static final int UNUSED_ZERO = 0;
        private static final int NONCE_SHIFT_BIT = 16;

        @Override
        public void writeTo(ByteBuf byteBuf, LispNonceLcafAddress address)
                                                    throws LispWriterException {
            int lcafIndex = byteBuf.writerIndex();
            LispLcafAddress.serializeCommon(byteBuf, address);

            // reserved field
            byteBuf.writeByte(UNUSED_ZERO);

            // nonce field
            int nonceFirst = address.getNonce() >> NONCE_SHIFT_BIT;
            byteBuf.writeShort((short) nonceFirst);
            int nonceSecond = address.getNonce() - (nonceFirst << NONCE_SHIFT_BIT);
            byteBuf.writeInt(nonceSecond);

            // address
            AfiAddressWriter writer = new AfiAddressWriter();
            writer.writeTo(byteBuf, address.getAddress());

            LispLcafAddress.updateLength(lcafIndex, byteBuf);
        }
    }
}


text:
package com.taobao.zeus.web.platform.client.module.jobmanager;

import java.util.Map;

import com.google.gwt.editor.client.Editor.Path;
import com.sencha.gxt.core.client.ValueProvider;
import com.sencha.gxt.data.shared.ModelKeyProvider;
import com.sencha.gxt.data.shared.PropertyAccess;

public interface JobModelProperties extends PropertyAccess<JobModel>{
	@Path("id")
	ModelKeyProvider<JobModel> key();

	ValueProvider<JobModel, String> id();

	ValueProvider<JobModel, String> name();

	ValueProvider<JobModel, String> status();

	ValueProvider<JobModel, Map<String, String>> readyDependencies();

	ValueProvider<JobModel, String> lastStatus();
}


text:
package vip.qianbai.cloud.client.api.one;
import lombok.Getter;
import lombok.Setter;

/**
 * fiegn fallback

 * @date    2017年2月25日

 * @author   陈小峰
 * @since    JDK 7
 */
@Setter
@Getter
public class UserFallback implements UserApiService {

	@Override
	public String hello() {
		return "hello user fallback";
	}

}


text:
package com.warkiz.indicatorseekbar.fragment;

import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.warkiz.indicatorseekbar.R;
import com.warkiz.widget.IndicatorSeekBar;
import com.warkiz.widget.OnSeekChangeListener;
import com.warkiz.widget.SeekParams;

/**
 * created by zhuangguangquan on  2017/9/6
 */

public class ContinuousFragment extends BaseFragment {

    @Override
    protected int getLayoutId() {
        return R.layout.continuous;
    }

    @Override
    protected void initView(View root) {
        //custom indicator text
        IndicatorSeekBar percent_indicator = root.findViewById(R.id.percent_indicator);
        percent_indicator.setIndicatorTextFormat("${PROGRESS} %");

        //scale
        IndicatorSeekBar scale = root.findViewById(R.id.scale);
        scale.setDecimalScale(4);
        View contentView = scale.getIndicator().getContentView();

        //thumb_drawable
        IndicatorSeekBar thumb_drawable = root.findViewById(R.id.thumb_drawable);
        thumb_drawable.setThumbDrawable(getResources().getDrawable(R.mipmap.ic_launcher));

        //set listener
        IndicatorSeekBar listenerSeekBar = root.findViewById(R.id.listener);
        final TextView states = root.findViewById(R.id.states);
        states.setText("states: ");
        final TextView progress = root.findViewById(R.id.progress);
        progress.setText("progress: " + listenerSeekBar.getProgress());
        final TextView progress_float = root.findViewById(R.id.progress_float);
        progress_float.setText("progress_float: " + listenerSeekBar.getProgressFloat());
        final TextView from_user = root.findViewById(R.id.from_user);
        from_user.setText("from_user: ");
        listenerSeekBar.setOnSeekChangeListener(new OnSeekChangeListener() {
            @Override
            public void onSeeking(SeekParams seekParams) {
                states.setText("states: onSeeking");
                progress.setText("progress: " + seekParams.progress);
                progress_float.setText("progress_float: " + seekParams.progressFloat);
                from_user.setText("from_user: " + seekParams.fromUser);
            }

            @Override
            public void onStartTrackingTouch(IndicatorSeekBar seekBar) {
                states.setText("states: onStart");
                progress.setText("progress: " + seekBar.getProgress());
                progress_float.setText("progress_float: " + seekBar.getProgressFloat());
                from_user.setText("from_user: true");
            }

            @Override
            public void onStopTrackingTouch(IndicatorSeekBar seekBar) {
                states.setText("states: onStop");
                progress.setText("progress: " + seekBar.getProgress());
                progress_float.setText("progress_float: " + seekBar.getProgressFloat());
                from_user.setText("from_user: false");
            }
        });
    }
}


text:
<tool id="obi_convert" name="obiconvert" version="@TOOL_VERSION@" profile="@PROFILE@">
    <description>converts sequence files to different output formats</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <command><![CDATA[
        @GUNZIP_INPUT@

        obiconvert
        #if $db
            -d '$db'
        #end if
        #if $tax
            -t '$tax'
        #end if
        @INPUT_FORMAT@
        @OUT_FORMAT@
        ${uppercase}
        ${ecopcrdb}
        #if str( $ecopcrdb) == "--ecopcrdb"
            --ecopcrdb-output=${ecopcrdb_output}
        #end if
        input
        @GZIP_OUTPUT@
        > '${output}'
        @GENERATE_GALAXY_JSON@
    ]]></command>
    <inputs>
        <param name="input" type="data" format="@INPUT_FORMATS@,txt,tabular" label="Input sequences file" help="database used for the in silico PCR. The database must be in the ecoPCR format (for example output of obiconvert)" />
        <param name="db" type="data" optional="true" format="txt,tabular" label="ecoPCR taxonomy database" />
        <param name="tax" type="data" optional="true" format="txt,tabular" label="NCBI taxonomy dump repository"/>
        <expand macro="input_format_options_macro"/>
        <expand macro="out_format_macro"/>
        <param name="ecopcrdb" type="boolean" truevalue="--ecopcrdb" falsevalue="" label="Do you want to create an ecoPCR database from sequence records results?"  help="Use this option if you want to generate an ecoPCR database output file" />
        <param name="uppercase" type="boolean" truevalue="--uppercase" falsevalue=""  label="Do you want to print sequences in upper case?" />
    </inputs>
    <outputs>
        <data format="txt" name="ecopcrdb_output" label="${tool.name} on ${on_string}: ecopcrdb">
            <filter>ecopcrdb == True</filter>
        </data>
        <data format="auto" name="output"/>
    </outputs>
    <tests>
        <test>
            <param name="input" value="output_obisort.fasta" />
            <param name="options_inputtype" value="--fasta"/>
            <param name="options_seqtype" value="--nuc"/>
            <param name="out_format" value="fasta"/>
            <param name="ecopcrdb" value="false"/>
            <param name="uppercase" value="true"/>
            <output name="output" file="output_obiconvert.fasta" ftype="fasta"/>
        </test>
    </tests>
    <help><![CDATA[

.. class:: infomark

**What it does**

obiconvert converts sequence files to different output formats. See the documentation for more details on the different formats.

Input files can be in :

fasta format

extended OBITools fasta format

Sanger fastq format

Solexa fastq format

ecoPCR format

ecoPCR database format

GenBank format

EMBL format

obiconvert converts those files to the :

extended OBITools fasta format

Sanger fastq format

ecoPCR database format

If no file name is specified, data is read from standard input.

@OBITOOLS_LINK@

    ]]>

    </help>
    <expand macro="citation" />
</tool>


text:
SCRIPT_LOCATION=$(readlink -f "$0") # Get the path of this file.
SCRIPT_DIR=$(dirname "$SCRIPT_LOCATION") # Get the path of the folder the file is current in.
CONFIG_DIR=$HOME/.config/keychain
FILES=(keychain.conf)
NAME="keychain"

#printf 'Script %s\n' $SCRIPT
#printf 'Script Dir %s\n' $SCRIPT_DIR

printf "\nInstalling %s config.\n" "$NAME"

if [ ! -d "$CONFIG_DIR" ]; then
  printf "Creating %s folder under %s.\n" "$NAME" "$CONFIG_DIR"
  mkdir -p "$CONFIG_DIR"
fi

for i in "${FILES[@]}"
do
  #printf "$i\n"
  if [ -a "$CONFIG_DIR"/"$i" ]; then
    printf "Removing %s from the config directory.\n" "$i"
    rm "$CONFIG_DIR"/"$i"
  fi

  printf "Making symb link for %s.\n" "$i"
  ln -s "$SCRIPT_DIR"/"$i" "$CONFIG_DIR"/"$i"

  printf "\n"
done

printf "%s installation complete.\n" "$NAME"


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Nuovo Giorn. Bot. Ital. 23: 129 (1891)

#### Original name
Thelotrema cinerellum Müll. Arg.

### Remarks
null


text:
namespace engine {
    namespace gfx{
        class Window;
        class Renderer {
        public:
            Renderer(ShaderProgram & program);

            void use();
            void stopUsing();
            void render(float dt, Window& window,glm::vec3& pos, glm::vec3& rot, glm::vec3& sca, Model& model);

        private:
            ShaderProgram & program_;
        };
    }
}