text:
package org.lwjgl.opengl;

import java.nio.*;

import org.lwjgl.system.*;

import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;

/**
 * Native bindings to the ARB_sampler_objects extension.
 *
 *
In unextended OpenGL textures are considered to be sets of image data (mip-chains, arrays, cube-map face sets, etc.) and sampling state (sampling mode,
 * mip-mapping state, coordinate wrapping and clamping rules, etc.) combined into a single object. It is typical for an application to use many textures
 * with a limited set of sampling states that are the same between them. In order to use textures in this way, an application must generate and configure
 * many texture names, adding overhead both to applications and to implementations. Furthermore, should an application wish to sample from a texture in
 * more than one way (with and without mip-mapping, for example) it must either modify the state of the texture or create two textures, each with a copy of
 * the same image data. This can introduce runtime and memory costs to the application.

 *
 *
This extension separates sampler state from texture image data. A new object type is introduced, the sampler (representing generic sampling parameters).
 * The new sampler objects are represented by a new named type encapsulating the sampling parameters of a traditional texture object. Sampler objects may
 * be bound to texture units to supplant the bound texture's sampling state. A single sampler may be bound to more than one texture unit simultaneously,
 * allowing different textures to be accessed with a single set of shared sampling parameters. Also, by binding different sampler objects to texture units
 * to which the same texture has been bound, the same texture image data may be sampled with different sampling parameters.

 *
 *
Promoted to core in {@link GL33 OpenGL 3.3}.

 */
public class ARBSamplerObjects {

	/** Accepted by the {@code value} parameter of the GetBooleanv, GetIntegerv, GetInteger64v, GetFloatv and GetDoublev functions. */
	public static final int GL_SAMPLER_BINDING = 0x8919;

	protected ARBSamplerObjects() {
		throw new UnsupportedOperationException();
	}

	static boolean isAvailable(GLCapabilities caps) {
		return checkFunctions(
			caps.glGenSamplers, caps.glDeleteSamplers, caps.glIsSampler, caps.glBindSampler, caps.glSamplerParameteri, caps.glSamplerParameterf,
			caps.glSamplerParameteriv, caps.glSamplerParameterfv, caps.glSamplerParameterIiv, caps.glSamplerParameterIuiv, caps.glGetSamplerParameteriv,
			caps.glGetSamplerParameterfv, caps.glGetSamplerParameterIiv, caps.glGetSamplerParameterIuiv
		);
	}

	// --- [ glGenSamplers ] ---

	/**
	 * Unsafe version of: {@link #glGenSamplers GenSamplers}
	 *
	 * @param count the number of sampler object names to generate
	 */
	public static void nglGenSamplers(int count, long samplers) {
		long __functionAddress = GL.getCapabilities().glGenSamplers;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, count, samplers);
	}

	/**
	 * Generates sampler object names.
	 *
	 * @param samplers a buffer in which the generated sampler object names are stored
	 */
	public static void glGenSamplers(IntBuffer samplers) {
		nglGenSamplers(samplers.remaining(), memAddress(samplers));
	}

	/** Generates sampler object names. */
	public static int glGenSamplers() {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			IntBuffer samplers = stack.callocInt(1);
			nglGenSamplers(1, memAddress(samplers));
			return samplers.get(0);
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	// --- [ glDeleteSamplers ] ---

	/**
	 * Unsafe version of: {@link #glDeleteSamplers DeleteSamplers}
	 *
	 * @param count the number of sampler objects to be deleted
	 */
	public static void nglDeleteSamplers(int count, long samplers) {
		long __functionAddress = GL.getCapabilities().glDeleteSamplers;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, count, samplers);
	}

	/**
	 * Deletes named sampler objects.
	 *
	 * @param samplers an array of sampler objects to be deleted
	 */
	public static void glDeleteSamplers(IntBuffer samplers) {
		nglDeleteSamplers(samplers.remaining(), memAddress(samplers));
	}

	/** Deletes named sampler objects. */
	public static void glDeleteSamplers(int sampler) {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			IntBuffer samplers = stack.ints(sampler);
			nglDeleteSamplers(1, memAddress(samplers));
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	// --- [ glIsSampler ] ---

	/**
	 * Determines if a name corresponds to a sampler object.
	 *
	 * @param sampler a value that may be the name of a sampler object
	 */
	public static boolean glIsSampler(int sampler) {
		long __functionAddress = GL.getCapabilities().glIsSampler;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		return callZ(__functionAddress, sampler);
	}

	// --- [ glBindSampler ] ---

	/**
	 * Binds a named sampler to a texturing target.
	 *
	 * @param unit    the index of the texture unit to which the sampler is bound
	 * @param sampler the name of a sampler
	 */
	public static void glBindSampler(int unit, int sampler) {
		long __functionAddress = GL.getCapabilities().glBindSampler;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callV(__functionAddress, unit, sampler);
	}

	// --- [ glSamplerParameteri ] ---

	/**
	 * Set the integer value of a sampler parameter.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a single-valued sampler parameter. One of:

{@link GL11#GL_TEXTURE_WRAP_S TEXTURE_WRAP_S}	{@link GL11#GL_TEXTURE_WRAP_T TEXTURE_WRAP_T}	{@link GL12#GL_TEXTURE_WRAP_R TEXTURE_WRAP_R}	{@link GL11#GL_TEXTURE_MIN_FILTER TEXTURE_MIN_FILTER}	{@link GL11#GL_TEXTURE_MAG_FILTER TEXTURE_MAG_FILTER}

{@link GL12#GL_TEXTURE_MIN_LOD TEXTURE_MIN_LOD}	{@link GL12#GL_TEXTURE_MAX_LOD TEXTURE_MAX_LOD}	{@link GL14#GL_TEXTURE_LOD_BIAS TEXTURE_LOD_BIAS}	{@link GL14#GL_TEXTURE_COMPARE_MODE TEXTURE_COMPARE_MODE}	{@link GL14#GL_TEXTURE_COMPARE_FUNC TEXTURE_COMPARE_FUNC}

	 * @param param   the value of {@code pname}
	 */
	public static void glSamplerParameteri(int sampler, int pname, int param) {
		long __functionAddress = GL.getCapabilities().glSamplerParameteri;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callV(__functionAddress, sampler, pname, param);
	}

	// --- [ glSamplerParameterf ] ---

	/**
	 * Float version of {@link #glSamplerParameteri SamplerParameteri}.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a single-valued sampler parameter
	 * @param param   the value of {@code pname}
	 */
	public static void glSamplerParameterf(int sampler, int pname, float param) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterf;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callV(__functionAddress, sampler, pname, param);
	}

	// --- [ glSamplerParameteriv ] ---

	/** Unsafe version of: {@link #glSamplerParameteriv SamplerParameteriv} */
	public static void nglSamplerParameteriv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameteriv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Pointer version of {@link #glSamplerParameteri SamplerParameteri}.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a sampler parameter. One of:

{@link GL11#GL_TEXTURE_BORDER_COLOR TEXTURE_BORDER_COLOR}	{@link GL11#GL_TEXTURE_WRAP_S TEXTURE_WRAP_S}	{@link GL11#GL_TEXTURE_WRAP_T TEXTURE_WRAP_T}	{@link GL12#GL_TEXTURE_WRAP_R TEXTURE_WRAP_R}

{@link GL11#GL_TEXTURE_MIN_FILTER TEXTURE_MIN_FILTER}	{@link GL11#GL_TEXTURE_MAG_FILTER TEXTURE_MAG_FILTER}	{@link GL12#GL_TEXTURE_MIN_LOD TEXTURE_MIN_LOD}	{@link GL12#GL_TEXTURE_MAX_LOD TEXTURE_MAX_LOD}

{@link GL14#GL_TEXTURE_LOD_BIAS TEXTURE_LOD_BIAS}	{@link GL14#GL_TEXTURE_COMPARE_MODE TEXTURE_COMPARE_MODE}	{@link GL14#GL_TEXTURE_COMPARE_FUNC TEXTURE_COMPARE_FUNC}

	 * @param params  an array where the value or values of {@code pname} are stored
	 */
	public static void glSamplerParameteriv(int sampler, int pname, IntBuffer params) {
		nglSamplerParameteriv(sampler, pname, memAddress(params));
	}

	// --- [ glSamplerParameterfv ] ---

	/** Unsafe version of: {@link #glSamplerParameterfv SamplerParameterfv} */
	public static void nglSamplerParameterfv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterfv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Float version of {@link #glSamplerParameteriv SamplerParameteriv}.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  an array where the value or values of {@code pname} are stored
	 */
	public static void glSamplerParameterfv(int sampler, int pname, FloatBuffer params) {
		nglSamplerParameterfv(sampler, pname, memAddress(params));
	}

	// --- [ glSamplerParameterIiv ] ---

	/** Unsafe version of: {@link #glSamplerParameterIiv SamplerParameterIiv} */
	public static void nglSamplerParameterIiv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterIiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Pure integer version of {@link #glSamplerParameteriv SamplerParameteriv}.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  an array where the value or values of {@code pname} are stored
	 */
	public static void glSamplerParameterIiv(int sampler, int pname, IntBuffer params) {
		nglSamplerParameterIiv(sampler, pname, memAddress(params));
	}

	// --- [ glSamplerParameterIuiv ] ---

	/** Unsafe version of: {@link #glSamplerParameterIuiv SamplerParameterIuiv} */
	public static void nglSamplerParameterIuiv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterIuiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Unsigned pure integer version of {@link #glSamplerParameteriv SamplerParameteriv}.
	 *
	 * @param sampler the sampler object whose parameter to modify
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  an array where the value or values of {@code pname} are stored
	 */
	public static void glSamplerParameterIuiv(int sampler, int pname, IntBuffer params) {
		nglSamplerParameterIuiv(sampler, pname, memAddress(params));
	}

	// --- [ glGetSamplerParameteriv ] ---

	/** Unsafe version of: {@link #glGetSamplerParameteriv GetSamplerParameteriv} */
	public static void nglGetSamplerParameteriv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameteriv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Return the integer value(s) of a sampler parameter.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter. One of:

{@link GL11#GL_TEXTURE_WRAP_S TEXTURE_WRAP_S}	{@link GL11#GL_TEXTURE_WRAP_T TEXTURE_WRAP_T}	{@link GL12#GL_TEXTURE_WRAP_R TEXTURE_WRAP_R}	{@link GL11#GL_TEXTURE_MIN_FILTER TEXTURE_MIN_FILTER}	{@link GL11#GL_TEXTURE_MAG_FILTER TEXTURE_MAG_FILTER}

{@link GL12#GL_TEXTURE_MIN_LOD TEXTURE_MIN_LOD}	{@link GL12#GL_TEXTURE_MAX_LOD TEXTURE_MAX_LOD}	{@link GL14#GL_TEXTURE_LOD_BIAS TEXTURE_LOD_BIAS}	{@link GL14#GL_TEXTURE_COMPARE_MODE TEXTURE_COMPARE_MODE}	{@link GL14#GL_TEXTURE_COMPARE_FUNC TEXTURE_COMPARE_FUNC}

,	{@link GL11#GL_TEXTURE_BORDER_COLOR TEXTURE_BORDER_COLOR}

	 * @param params  the sampler parameters
	 */
	public static void glGetSamplerParameteriv(int sampler, int pname, IntBuffer params) {
		if ( CHECKS )
			checkBuffer(params, 1);
		nglGetSamplerParameteriv(sampler, pname, memAddress(params));
	}

	/**
	 * Return the integer value(s) of a sampler parameter.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter. One of:

{@link GL11#GL_TEXTURE_WRAP_S TEXTURE_WRAP_S}	{@link GL11#GL_TEXTURE_WRAP_T TEXTURE_WRAP_T}	{@link GL12#GL_TEXTURE_WRAP_R TEXTURE_WRAP_R}	{@link GL11#GL_TEXTURE_MIN_FILTER TEXTURE_MIN_FILTER}	{@link GL11#GL_TEXTURE_MAG_FILTER TEXTURE_MAG_FILTER}

{@link GL12#GL_TEXTURE_MIN_LOD TEXTURE_MIN_LOD}	{@link GL12#GL_TEXTURE_MAX_LOD TEXTURE_MAX_LOD}	{@link GL14#GL_TEXTURE_LOD_BIAS TEXTURE_LOD_BIAS}	{@link GL14#GL_TEXTURE_COMPARE_MODE TEXTURE_COMPARE_MODE}	{@link GL14#GL_TEXTURE_COMPARE_FUNC TEXTURE_COMPARE_FUNC}

,	{@link GL11#GL_TEXTURE_BORDER_COLOR TEXTURE_BORDER_COLOR}

	 */
	public static int glGetSamplerParameteri(int sampler, int pname) {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			IntBuffer params = stack.callocInt(1);
			nglGetSamplerParameteriv(sampler, pname, memAddress(params));
			return params.get(0);
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	// --- [ glGetSamplerParameterfv ] ---

	/** Unsafe version of: {@link #glGetSamplerParameterfv GetSamplerParameterfv} */
	public static void nglGetSamplerParameterfv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterfv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Float version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  the sampler parameters
	 */
	public static void glGetSamplerParameterfv(int sampler, int pname, FloatBuffer params) {
		if ( CHECKS )
			checkBuffer(params, 1);
		nglGetSamplerParameterfv(sampler, pname, memAddress(params));
	}

	/**
	 * Float version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 */
	public static float glGetSamplerParameterf(int sampler, int pname) {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			FloatBuffer params = stack.callocFloat(1);
			nglGetSamplerParameterfv(sampler, pname, memAddress(params));
			return params.get(0);
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	// --- [ glGetSamplerParameterIiv ] ---

	/** Unsafe version of: {@link #glGetSamplerParameterIiv GetSamplerParameterIiv} */
	public static void nglGetSamplerParameterIiv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterIiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Pure integer version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  the sampler parameters
	 */
	public static void glGetSamplerParameterIiv(int sampler, int pname, IntBuffer params) {
		if ( CHECKS )
			checkBuffer(params, 1);
		nglGetSamplerParameterIiv(sampler, pname, memAddress(params));
	}

	/**
	 * Pure integer version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 */
	public static int glGetSamplerParameterIi(int sampler, int pname) {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			IntBuffer params = stack.callocInt(1);
			nglGetSamplerParameterIiv(sampler, pname, memAddress(params));
			return params.get(0);
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	// --- [ glGetSamplerParameterIuiv ] ---

	/** Unsafe version of: {@link #glGetSamplerParameterIuiv GetSamplerParameterIuiv} */
	public static void nglGetSamplerParameterIuiv(int sampler, int pname, long params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterIuiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/**
	 * Unsigned pure integer version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 * @param params  the sampler parameters
	 */
	public static void glGetSamplerParameterIuiv(int sampler, int pname, IntBuffer params) {
		if ( CHECKS )
			checkBuffer(params, 1);
		nglGetSamplerParameterIuiv(sampler, pname, memAddress(params));
	}

	/**
	 * Unsigned pure integer version of {@link #glGetSamplerParameteriv GetSamplerParameteriv}.
	 *
	 * @param sampler the name of the sampler object from which to retrieve parameters
	 * @param pname   the symbolic name of a sampler parameter
	 */
	public static int glGetSamplerParameterIui(int sampler, int pname) {
		MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
		try {
			IntBuffer params = stack.callocInt(1);
			nglGetSamplerParameterIuiv(sampler, pname, memAddress(params));
			return params.get(0);
		} finally {
			stack.setPointer(stackPointer);
		}
	}

	/** Array version of: {@link #glGenSamplers GenSamplers} */
	public static void glGenSamplers(int[] samplers) {
		long __functionAddress = GL.getCapabilities().glGenSamplers;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, samplers.length, samplers);
	}

	/** Array version of: {@link #glDeleteSamplers DeleteSamplers} */
	public static void glDeleteSamplers(int[] samplers) {
		long __functionAddress = GL.getCapabilities().glDeleteSamplers;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, samplers.length, samplers);
	}

	/** Array version of: {@link #glSamplerParameteriv SamplerParameteriv} */
	public static void glSamplerParameteriv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameteriv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glSamplerParameterfv SamplerParameterfv} */
	public static void glSamplerParameterfv(int sampler, int pname, float[] params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterfv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glSamplerParameterIiv SamplerParameterIiv} */
	public static void glSamplerParameterIiv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterIiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glSamplerParameterIuiv SamplerParameterIuiv} */
	public static void glSamplerParameterIuiv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glSamplerParameterIuiv;
		if ( CHECKS )
			checkFunctionAddress(__functionAddress);
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glGetSamplerParameteriv GetSamplerParameteriv} */
	public static void glGetSamplerParameteriv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameteriv;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkBuffer(params, 1);
		}
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glGetSamplerParameterfv GetSamplerParameterfv} */
	public static void glGetSamplerParameterfv(int sampler, int pname, float[] params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterfv;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkBuffer(params, 1);
		}
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glGetSamplerParameterIiv GetSamplerParameterIiv} */
	public static void glGetSamplerParameterIiv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterIiv;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkBuffer(params, 1);
		}
		callPV(__functionAddress, sampler, pname, params);
	}

	/** Array version of: {@link #glGetSamplerParameterIuiv GetSamplerParameterIuiv} */
	public static void glGetSamplerParameterIuiv(int sampler, int pname, int[] params) {
		long __functionAddress = GL.getCapabilities().glGetSamplerParameterIuiv;
		if ( CHECKS ) {
			checkFunctionAddress(__functionAddress);
			checkBuffer(params, 1);
		}
		callPV(__functionAddress, sampler, pname, params);
	}

}


text:
import {Component} from '@angular/core';
@Component({
 selector: 'time',
 template: `<h2>current time {{today | date:'shortTime'}}`
})
export class TimeComponent {
	today:number = Date.now();
}

redpajama_set_name: RedPajamaGithub


text:
package jadx.core.dex.visitors.regions;

import jadx.core.dex.nodes.IBlock;
import jadx.core.dex.nodes.IRegion;
import jadx.core.dex.nodes.MethodNode;

public abstract class AbstractRegionVisitor implements IRegionVisitor {

	@Override
	public void enterRegion(MethodNode mth, IRegion region) {
	}

	@Override
	public void processBlock(MethodNode mth, IBlock container) {
	}

	@Override
	public void leaveRegion(MethodNode mth, IRegion region) {
	}

}


text:
package org.apache.myfaces.trinidadinternal.agent;

import java.util.Set;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.AbstractMap;
import java.util.HashSet;
import java.util.Collections;

/**
 * Pretty much the same Impl of UIX CapabilityMap, with following changes
 * -- Actually a map implementation now
 * -- added support to get Entries (To support a map interface)
 * -- Also this impl assumes that the number of keys **will** change (increase) after init.
 *
 */
// FIXME -= Simon Lessard =-
//       This is another map that can accept both String and another type as keys.
//       Shouldn't we force type safety with a single key type ?
//       -= Adam Winer =-
//       This, supports Strings and CapabilityKey.  In theory, using
//       CapabilityKey is faster, which lets our built-in renderers
//       execute faster.  A fair question is whether this is a real
//       issue.  At the moment, however, it is definitely the case
//       that we are using CapabilityKey inside our code, and yet we
//       haven't made the plunge to require everyone to use
//       CapabilityKey on Agent (or make CapabilityKey public).
public class CapabilityMap extends AbstractMap<Object, Object> implements Cloneable
{

  private CapabilityMap()
  {
  }

  CapabilityMap(Object[][] keyValuesArr)
  {

    int arrayCount = keyValuesArr.length;
    CapabilityKey[][] keyArrays = new CapabilityKey[arrayCount][];

    for (int arrayIndex = 0; arrayIndex < arrayCount; arrayIndex++)
    {
      keyArrays[arrayIndex] = new CapabilityKey[
              keyValuesArr[arrayIndex] == null ? 0 : (keyValuesArr[arrayIndex].length >> 1)];
    }

    //Get All the Keys
    //determine how many keys we need. The keys list/count could change hence
    //need to find max key index.
    int maxKeyIndex = 0;
    for (int arrayIndex = 0; arrayIndex < arrayCount; arrayIndex++)
    {
      Object[] keyValues = keyValuesArr[arrayIndex];
      CapabilityKey[] keys = keyArrays[arrayIndex];
      int keyCount = keys.length;

      for (int i = 0; i < keyCount; i++)
      {
        keys[i] = (CapabilityKey) keyValues[i << 1];
        maxKeyIndex = _max(keys[i].getIndex(), maxKeyIndex);
      }
    }

    _indexedValues = new Object[maxKeyIndex + 1];
    for (int arrayIndex = 0; arrayIndex < arrayCount; arrayIndex++)
    {
      Object[] keyValues = keyValuesArr[arrayIndex];
      CapabilityKey[] keys = keyArrays[arrayIndex];
      int keyCount = keys.length;

      for (int i = 0; i < keyCount; i++)
      {
        _indexedValues[keys[i].getIndex()] = keyValues[(i << 1) + 1];
      }
    }
  }

  /**
   * @param capKey
   * @return value object for the capability
   */
  public Object getCapability(CapabilityKey capKey)
  {
    int keyIndex = capKey.getIndex();

    if (keyIndex < _indexedValues.length)
      return _indexedValues[keyIndex];

    return null;
  }

  /**
   * @param capabilities
   * @return  returns a new capability map that merges key/values of the provided map
   */
  public CapabilityMap merge(Map<Object, Object> capabilities)
  {
    if ((capabilities == null) || (capabilities.isEmpty()))
      return this;

    return merge(_getMapAsArray(capabilities));
  }

  /**
   * @param capabilities
   * @return
   */
  //Doing this as current Impl. uses this method
  public CapabilityMap merge(Object[] capabilities)
  {
    // could simply do this but .....
    // new CapabilitiesImpl (new Object[][] {_getCapabilitiesAsArray(),
    //                                       capabilities});

    if ((capabilities == null) || (capabilities.length <= 0))
      return this;

    int maxKeyIndex = _indexedValues.length;
    Object[] capKeys = new Object[capabilities.length >> 1];
    Object[] capValues = new Object[capabilities.length >> 1];
    for (int i = 0, j = 0; i < capabilities.length - 1; i++)
    {
      CapabilityKey capKey = (CapabilityKey) capabilities[i++];
      capKeys[j] = capKey;
      capValues[j++] = capabilities[i];
      maxKeyIndex = _max(capKey.getIndex(), maxKeyIndex);
    }

    //new structures
    Object[] indexedValues = new Object[maxKeyIndex + 1];

    //Copy the values
    System.arraycopy(_indexedValues, 0, indexedValues, 0, _indexedValues.length);
    for (int i = 0; i < capKeys.length; i++)
    {
      CapabilityKey capKey = (CapabilityKey) capKeys[i];
      int keyIndex = capKey.getIndex();
      indexedValues[keyIndex] = capValues[i];
    }

    CapabilityMap newImpl = new CapabilityMap();
    newImpl._indexedValues = indexedValues;
    return newImpl;
  }

  //Implementation of Map Methods
  /**
   * @param key
   * @return
   */
  @Override
  public Object get(Object key)
  {
    if (key == null)
      return null;

    if (key instanceof CapabilityKey)
      return getCapability((CapabilityKey) key);

    return _get(key.toString());
  }

  /**
   * @param key
   * @param value
   * @return
   */
  @Override
  public Object put(Object key, Object value)
  {
    throw new UnsupportedOperationException();
  }

  /**
   * @return
   */
  @Override
  public Set<Map.Entry<Object, Object>> entrySet()
  {
    if (_entrySet == null)
      _createEntrySet();

    return _entrySet;
  }

  @Override
  public Object clone()
  {
    try
    {
      CapabilityMap that = (CapabilityMap) super.clone();
      that._indexedValues = _indexedValues.clone();
      that._entrySet = null;
      return that;
    }
    catch (CloneNotSupportedException cnse)
    {
      assert false;
      return null;
    }
  }

  private Object _get(String key)
  {
    //key == null should be done before
    CapabilityKey key0 = null;
    Object value = null;
    key0 = CapabilityKey.getCapabilityKey(key);
    if (key0 != null)
      value = getCapability(key0);

    return value;
  }

  synchronized private void _createEntrySet()
  {
    if (_entrySet == null)
    {
      HashSet<Map.Entry<Object, Object>> hs =
        new HashSet<Map.Entry<Object, Object>>();
      Iterator<Object> iter = new KeyIterator();
      while (iter.hasNext())
      {
        CapabilityKey capKey = (CapabilityKey) iter.next();
        Object value = getCapability(capKey);
        CEntry ce = new CEntry(capKey.getCapabilityName(), value);
        hs.add(ce);
      }
      //Don't allow clear(), remove(), etc etc on the map
      _entrySet = Collections.unmodifiableSet(hs);
    }
  }

  private int _max(int value1, int value2)
  {
    return (value1 > value2 ? value1 : value2);
  }

  private Object[] _getMapAsArray(Map<Object, Object> capabilities)
  {
    Object[] caps = new Object[capabilities.size() * 2];
    int i = 0;
    for (Map.Entry<Object, Object> entry : capabilities.entrySet())
    {
      Object key = entry.getKey();
      CapabilityKey capKey = key instanceof CapabilityKey
                             ? (CapabilityKey) key
                             : CapabilityKey.getCapabilityKey((String) key);
      caps[i++] = capKey;
      caps[i++] = entry.getValue();
    }
    return caps;
  }

  //KeyIterator
  private class KeyIterator implements Iterator<Object>
  {
    public KeyIterator()
    {
      _setNext();
    }

    public void remove()
    {
      throw new UnsupportedOperationException();
    }

    public boolean hasNext()
    {
      if (_next != null)
        return true;
      return false;
    }

    public Object next()
    {
      if (_next == null)
        _setNext();

      if (_next != null)
      {
        CapabilityKey next = _next;
        _setNext();
        return next;
      }

      throw new NoSuchElementException();
    }

    private void _setNext()
    {
      _next = null;
      for (int i = _current; i < _indexedValues.length; i++)
      {
        if (_indexedValues[i] != null)
        {
          _next = CapabilityKey.getKeyAt(i);
          _current = ++i;
          break;
        }
      }
    }

    private int _current = 0;
    private CapabilityKey _next = null;

  }

  //Map Entry
  static private class CEntry implements Entry<Object, Object>
  {

    private Object key;
    private Object value;

    CEntry(Object key, Object value)
    {
      this.key = key;
      this.value = value;
    }

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

      if (!(o instanceof CEntry))
        return false;

      CEntry ce = (CEntry) o;
      return ((ce.key == key || ce.key.equals(key)) &&
              (value == null ? ce.value == null : ce.value.equals(value)));
    }

    public Object getKey()
    {
      return key;
    }

    public Object getValue()
    {
      return value;
    }

    public Object setValue(Object newValue)
    {
      throw new UnsupportedOperationException();
    }

    @Override
    public int hashCode()
    {
      return key.hashCode() ^ (value == null ? 0 : value.hashCode());
    }
  }

  private Object[] _indexedValues;
  private Set<Map.Entry<Object, Object>> _entrySet;
}


text:
#include "RecordingBench.h"
#include "SkBBHFactory.h"
#include "SkLiteDL.h"
#include "SkLiteRecorder.h"
#include "SkPictureRecorder.h"

PictureCentricBench::PictureCentricBench(const char* name, const SkPicture* pic) : fName(name) {
    // Flatten the source picture in case it's trivially nested (useless for timing).
    SkPictureRecorder rec;
    pic->playback(rec.beginRecording(pic->cullRect(), nullptr,
                                     SkPictureRecorder::kPlaybackDrawPicture_RecordFlag));
    fSrc = rec.finishRecordingAsPicture();
}

const char* PictureCentricBench::onGetName() {
    return fName.c_str();
}

bool PictureCentricBench::isSuitableFor(Backend backend) {
    return backend == kNonRendering_Backend;
}

SkIPoint PictureCentricBench::onGetSize() {
    return SkIPoint::Make(SkScalarCeilToInt(fSrc->cullRect().width()),
                          SkScalarCeilToInt(fSrc->cullRect().height()));
}

///////////////////////////////////////////////////////////////////////////////////////////////////

RecordingBench::RecordingBench(const char* name, const SkPicture* pic, bool useBBH, bool lite)
    : INHERITED(name, pic)
    , fUseBBH(useBBH)
{
    // If we're recording into an SkLiteDL, also record _from_ one.
    if (lite) {
        fDL.reset(new SkLiteDL());
        SkLiteRecorder r;
        r.reset(fDL.get(), fSrc->cullRect().roundOut());
        fSrc->playback(&r);
    }
}

void RecordingBench::onDraw(int loops, SkCanvas*) {
    if (fDL) {
        SkLiteRecorder rec;
        while (loops --> 0) {
            SkLiteDL dl;
            rec.reset(&dl, fSrc->cullRect().roundOut());
            fDL->draw(&rec);
        }

    } else {
        SkRTreeFactory factory;
        SkPictureRecorder recorder;
        while (loops --> 0) {
            fSrc->playback(recorder.beginRecording(fSrc->cullRect(), fUseBBH ? &factory : nullptr));
            (void)recorder.finishRecordingAsPicture();
        }
    }
}

///////////////////////////////////////////////////////////////////////////////////////////////////
#include "SkSerialProcs.h"

DeserializePictureBench::DeserializePictureBench(const char* name, sk_sp<SkData> data)
    : fName(name)
    , fEncodedPicture(std::move(data))
{}

const char* DeserializePictureBench::onGetName() {
    return fName.c_str();
}

bool DeserializePictureBench::isSuitableFor(Backend backend) {
    return backend == kNonRendering_Backend;
}

SkIPoint DeserializePictureBench::onGetSize() {
    return SkIPoint::Make(128, 128);
}

void DeserializePictureBench::onDraw(int loops, SkCanvas*) {
    for (int i = 0; i < loops; ++i) {
        SkPicture::MakeFromData(fEncodedPicture.get());
    }
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour {

    public int life;
    public float moveSpeed;
    public int damage;
    public float range;
}


text:
class AddUrlSlugsToPosts < ActiveRecord::Migration
  def change
    add_column :posts, :url_slug, :string
  end
end


text:
package org.teavm.samples.benchmark;

import org.jbox2d.collision.shapes.CircleShape;
import org.jbox2d.collision.shapes.PolygonShape;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.jbox2d.dynamics.joints.RevoluteJointDef;

/**
 *
 * @author Alexey Andreev
 */
public class Scene {
    private World world;
    private Body axis;
    private Body reel;
    private long lastCalculated;
    private long startTime;

    public Scene() {
        world = new World(new Vec2(0, -9.8f));
        initAxis();
        initReel();
        joinReelToAxis();
        initBalls();
        lastCalculated = System.currentTimeMillis();
        startTime = lastCalculated;
    }

    private void initAxis() {
        BodyDef axisDef = new BodyDef();
        axisDef.type = BodyType.STATIC;
        axisDef.position = new Vec2(3, 3);
        axis = world.createBody(axisDef);

        CircleShape axisShape = new CircleShape();
        axisShape.setRadius(0.02f);
        axisShape.m_p.set(0, 0);

        FixtureDef axisFixture = new FixtureDef();
        axisFixture.shape = axisShape;
        axis.createFixture(axisFixture);
    }

    private void initReel() {
        BodyDef reelDef = new BodyDef();
        reelDef.type = BodyType.DYNAMIC;
        reelDef.position = new Vec2(3, 3);
        reel = world.createBody(reelDef);

        FixtureDef fixture = new FixtureDef();
        fixture.friction = 0.5f;
        fixture.restitution = 0.4f;
        fixture.density = 1;

        int parts = 30;
        for (int i = 0; i < parts; ++i) {
            PolygonShape shape = new PolygonShape();
            double angle1 = i / (double) parts * 2 * Math.PI;
            double x1 = 2.7 * Math.cos(angle1);
            double y1 = 2.7 * Math.sin(angle1);
            double angle2 = (i + 1) / (double) parts * 2 * Math.PI;
            double x2 = 2.7 * Math.cos(angle2);
            double y2 = 2.7 * Math.sin(angle2);
            double angle = (angle1 + angle2) / 2;
            double x = 0.01 * Math.cos(angle);
            double y = 0.01 * Math.sin(angle);

            shape.set(new Vec2[] { new Vec2((float) x1, (float) y1), new Vec2((float) x2, (float) y2),
                    new Vec2((float) (x2 - x), (float) (y2 - y)), new Vec2((float) (x1 - x), (float) (y1 - y)) }, 4);
            fixture.shape = shape;
            reel.createFixture(fixture);
        }
    }

    private void initBalls() {
        float ballRadius = 0.15f;

        BodyDef ballDef = new BodyDef();
        ballDef.type = BodyType.DYNAMIC;
        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.friction = 0.3f;
        fixtureDef.restitution = 0.3f;
        fixtureDef.density = 0.2f;
        CircleShape shape = new CircleShape();
        shape.m_radius = ballRadius;
        fixtureDef.shape = shape;

        for (int i = 0; i < 5; ++i) {
            for (int j = 0; j < 5; ++j) {
                float x = (j + 0.5f) * (ballRadius * 2 + 0.01f);
                float y = (i + 0.5f) * (ballRadius * 2 + 0.01f);
                ballDef.position.x = 3 + x;
                ballDef.position.y = 3 + y;
                Body body = world.createBody(ballDef);
                body.createFixture(fixtureDef);

                ballDef.position.x = 3 - x;
                ballDef.position.y = 3 + y;
                body = world.createBody(ballDef);
                body.createFixture(fixtureDef);

                ballDef.position.x = 3 + x;
                ballDef.position.y = 3 - y;
                body = world.createBody(ballDef);
                body.createFixture(fixtureDef);

                ballDef.position.x = 3 - x;
                ballDef.position.y = 3 - y;
                body = world.createBody(ballDef);
                body.createFixture(fixtureDef);
            }
        }
    }

    private void joinReelToAxis() {
        RevoluteJointDef jointDef = new RevoluteJointDef();
        jointDef.bodyA = axis;
        jointDef.bodyB = reel;
        world.createJoint(jointDef);
    }

    public void calculate() {
        long currentTime = System.currentTimeMillis();
        int timeToCalculate = (int) (currentTime - lastCalculated);
        long relativeTime = currentTime - startTime;
        while (timeToCalculate > 10) {
            int period = (int) ((relativeTime + 5000) / 10000);
            reel.applyTorque(period % 2 == 0 ? 8f : -8f);
            world.step(0.01f, 20, 40);
            lastCalculated += 10;
            timeToCalculate -= 10;
        }
    }

    public int timeUntilNextStep() {
        return (int) Math.max(0, lastCalculated + 10 - System.currentTimeMillis());
    }

    public World getWorld() {
        return world;
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Azure.Core.Pipeline;
using Azure.Core.TestFramework;
using Moq;
using NUnit.Framework;

namespace Azure.Core.Tests
{
    public class HttpPipelineBuilderTest : PolicyTestBase
    {
        [Theory]
        [TestCase(HttpPipelinePosition.PerCall, 1)]
        [TestCase(HttpPipelinePosition.PerRetry, 2)]
        [TestCase(HttpPipelinePosition.BeforeTransport, 2)]
        public async Task CanAddCustomPolicy(HttpPipelinePosition position, int expectedCount)
        {
            var policy = new CounterPolicy();
            var transport = new MockTransport(new MockResponse(503), new MockResponse(200));

            var options = new TestOptions();
            options.AddPolicy(policy, position);
            options.Transport = transport;

            HttpPipeline pipeline = HttpPipelineBuilder.Build(options);

            using Request request = transport.CreateRequest();
            request.Method = RequestMethod.Get;
            request.Uri.Reset(new Uri("http://example.com"));

            Response response = await pipeline.SendRequestAsync(request, CancellationToken.None);

            Assert.AreEqual(200, response.Status);
            Assert.AreEqual(expectedCount, policy.ExecutionCount);
        }

        [Test]
        public async Task CustomPolicyOrdering()
        {
            bool perCallRan = false;
            bool perRetryRan = false;
            bool beforeTransportRan = false;

            var transport = new MockTransport(new MockResponse(200));
            var options = new TestOptions();

            options.AddPolicy(new CallbackPolicy(m =>
            {
                perCallRan = true;
                Assert.False(perRetryRan);
                Assert.False(beforeTransportRan);
            }), HttpPipelinePosition.PerCall);

            options.AddPolicy(new CallbackPolicy(m =>
            {
                perRetryRan = true;
                Assert.True(perCallRan);
                Assert.False(beforeTransportRan);
            }), HttpPipelinePosition.PerRetry);

            options.AddPolicy(new CallbackPolicy(m =>
            {
                beforeTransportRan = true;
                Assert.True(perRetryRan);
                Assert.True(perCallRan);
            }), HttpPipelinePosition.BeforeTransport);

            options.Transport = transport;

            HttpPipeline pipeline = HttpPipelineBuilder.Build(options);

            using Request request = transport.CreateRequest();
            request.Method = RequestMethod.Get;
            request.Uri.Reset(new Uri("http://example.com"));

            await pipeline.SendRequestAsync(request, CancellationToken.None);

            Assert.True(perRetryRan);
            Assert.True(perCallRan);
            Assert.True(beforeTransportRan);
        }

        [Test]
        public async Task UsesAssemblyNameAndInformationalVersionForTelemetryPolicySettings()
        {
            var transport = new MockTransport(new MockResponse(503), new MockResponse(200));
            var options = new TestOptions
            {
                Transport = transport
            };

            HttpPipeline pipeline = HttpPipelineBuilder.Build(options);

            using Request request = transport.CreateRequest();
            request.Method = RequestMethod.Get;
            request.Uri.Reset(new Uri("http://example.com"));

            await pipeline.SendRequestAsync(request, CancellationToken.None);

            var informationalVersion = typeof(TestOptions).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
            informationalVersion = informationalVersion.Substring(0, informationalVersion.IndexOf('+'));

            Assert.True(request.Headers.TryGetValue("User-Agent", out string value));
            StringAssert.StartsWith($"azsdk-net-Core.Tests/{informationalVersion} ", value);
        }

        [Test]
        public async Task VersionDoesntHaveCommitHash()
        {
            var transport = new MockTransport(new MockResponse(200));
            var telemetryPolicy = HttpPipelineBuilder.CreateTelemetryPolicy(new TestOptions());

            await SendGetRequest(transport, telemetryPolicy);

            Assert.True(transport.SingleRequest.TryGetHeader("User-Agent", out var userAgent));
            StringAssert.IsMatch(Regex.Escape("azsdk-net-Core.Tests/") +
                                 "[.\\-0-9a-z]+" +
                                 Regex.Escape($" ({RuntimeInformation.FrameworkDescription}; {RuntimeInformation.OSDescription})"), userAgent);
        }

        [Test]
        public async Task CustomClientRequestIdAvailableInPerCallPolicies()
        {
            var policy = new Mock<HttpPipelineSynchronousPolicy>();
            policy.CallBase = true;
            policy.Setup(p => p.OnSendingRequest(It.IsAny<HttpMessage>()))
                .Callback<HttpMessage>(message =>
                {
                    Assert.AreEqual("ExternalClientId",message.Request.ClientRequestId);
                    Assert.True(message.Request.TryGetHeader("x-ms-client-request-id", out string requestId));
                    Assert.AreEqual("ExternalClientId", requestId);
                }).Verifiable();

            var options = new TestOptions();
            options.Transport = new MockTransport(new MockResponse(200));
            options.AddPolicy(policy.Object, HttpPipelinePosition.PerCall);

            var pipeline = HttpPipelineBuilder.Build(options);
            using (Request request = pipeline.CreateRequest())
            {
                request.Method = RequestMethod.Get;
                request.Uri.Reset(new Uri("http://example.com"));
                request.Headers.Add("x-ms-client-request-id", "ExternalClientId");
                await pipeline.SendRequestAsync(request, CancellationToken.None);
            }

            policy.Verify();
        }

        [Test]
        public async Task CustomClientRequestIdSetInPerCallPolicyAppliedAsAHeader()
        {
            var policy = new Mock<HttpPipelineSynchronousPolicy>();
            policy.CallBase = true;
            policy.Setup(p => p.OnSendingRequest(It.IsAny<HttpMessage>()))
                .Callback<HttpMessage>(message =>
                {
                    message.Request.ClientRequestId = "MyPolicyClientId";
                }).Verifiable();

            var options = new TestOptions();
            var transport = new MockTransport(new MockResponse(200));
            options.Transport = transport;
            options.AddPolicy(policy.Object, HttpPipelinePosition.PerCall);

            var pipeline = HttpPipelineBuilder.Build(options);
            using (Request request = pipeline.CreateRequest())
            {
                request.Method = RequestMethod.Get;
                request.Uri.Reset(new Uri("http://example.com"));
                request.Headers.Add("x-ms-client-request-id", "ExternalClientId");
                await pipeline.SendRequestAsync(request, CancellationToken.None);
            }

            policy.Verify();

            Assert.True(transport.SingleRequest.Headers.TryGetValue("x-ms-client-request-id", out var value));
            Assert.AreEqual("MyPolicyClientId", value);
        }

        private class TestOptions : ClientOptions
        {
            public TestOptions()
            {
                Retry.Delay = TimeSpan.Zero;
            }
        }

        private class CounterPolicy : HttpPipelineSynchronousPolicy
        {
            public override void OnSendingRequest(HttpMessage message)
            {
                ExecutionCount++;
            }

            public int ExecutionCount { get; set; }
        }

        private class CallbackPolicy : HttpPipelineSynchronousPolicy
        {
            private readonly Action<HttpMessage> _message;

            public CallbackPolicy(Action<HttpMessage> message)
            {
                _message = message;
            }

            public override void OnSendingRequest(HttpMessage message)
            {
                _message(message);
            }
        }
    }
}


text:
using LmpClient.Base;

namespace LmpClient.Systems.PlayerConnection
{
    public class PlayerConnectionSystem : MessageSystem<PlayerConnectionSystem, PlayerConnectionMessageSender, PlayerConnectionMessageHandler>
    {
        public override string SystemName { get; } = nameof(PlayerConnectionSystem);
    }
}


text:
package com.intellij.codeInsight.generation;

import javax.annotation.Nonnull;

import com.intellij.codeInsight.hint.HintManager;
import com.intellij.lang.LanguageCodeInsightActionHandler;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiJavaFile;

/**
 * @author yole
 */
public class JavaOverrideMethodsHandler implements LanguageCodeInsightActionHandler {
  @Override
  public boolean isValidFor(final Editor editor, final PsiFile file) {
    if (!(file instanceof PsiJavaFile)) {
      return false;
    }

    PsiClass aClass = OverrideImplementUtil.getContextClass(file.getProject(), editor, file, true);
    return aClass != null && !OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty();
  }

  @Override
  public void invoke(@Nonnull final Project project, @Nonnull final Editor editor, @Nonnull final PsiFile file) {
    PsiClass aClass = OverrideImplementUtil.getContextClass(project, editor, file, true);
    if (aClass == null) return;

    if (OverrideImplementUtil.getMethodSignaturesToOverride(aClass).isEmpty()) {
      HintManager.getInstance().showErrorHint(editor, "No methods to override have been found");
      return;
    }
    OverrideImplementUtil.chooseAndOverrideMethods(project, editor, aClass);
  }

  @Override
  public boolean startInWriteAction() {
    return false;
  }
}


text:
describe("SWOS-63: Schema/Model labeling", () => {
  describe("SchemaS/Models section", () => {
    it("should render `Schemas` for OpenAPI 3", () => {
      cy
        .visit("/?url=/documents/petstore-expanded.openapi.yaml")
        .get("section.models > h4")
        .contains("Schemas")
    })
    it("should render `Models` for OpenAPI 2", () => {
      cy
        .visit("/?url=/documents/petstore.swagger.yaml")
        .get("section.models > h4")
        .contains("Models")
    })
  })
  describe("ModelExample within Operation", () => {
    it("should render `Schemas` for OpenAPI 3", () => {
      cy
        .visit("/?url=/documents/petstore-expanded.openapi.yaml")
        .get("#operations-default-findPets")
        .click()
        .get("a.tablinks[data-name=model]")
        .contains("Schema")
    })
    it("should render `Models` for OpenAPI 2", () => {
      cy
        .visit("/?url=/documents/petstore.swagger.yaml")
        .get("section.models > h4")
        .get("#operations-pet-addPet")
        .click()
        .get("a.tablinks[data-name=model]")
        .contains("Model")
    })
  })
})


text:
module.exports.conf = require('./config/onesession.conf.js');
var http = require('http');
var options = {
  host: '127.0.0.1',
  port: 3000,
  path: '/static/evo.jpg?name=iiiii',
  headers:{"content-length":"15", "content-type":"application/x-www-form-urlencoded; charset=UTF-8"},
method: 'HEAD',
 //method: 'PUT',
// method: 'DELETE',
//	method:'GET',
};

var req = http.request(options, function(res) {
  console.log('STATUS: ' + res.statusCode);
  console.log('HEADERS: ' + JSON.stringify(res.headers));
  res.setEncoding('utf8');
  res.on('data', function (chunk) {
    console.log('BODY: ' + chunk);
  });
});

req.on('error', function(e) {
  console.log('problem with request: ' + e.message);
});

// write data to request body
req.write('ttt=yyy&zzz=uuu');
req.end();


text:
class Certificate < ActiveRecord::Base
  belongs_to :movie
end


text:
package com.newatlanta.appengine.junit.nio.file;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

import org.junit.Test;

import com.newatlanta.appengine.junit.vfs.gae.GaeVfsTestCase;
import com.newatlanta.repackaged.java.nio.file.Path;
import com.newatlanta.repackaged.java.nio.file.Paths;
import com.newatlanta.repackaged.java.nio.file.attribute.AclEntry;
import com.newatlanta.repackaged.java.nio.file.attribute.Attributes;
import com.newatlanta.repackaged.java.nio.file.attribute.BasicFileAttributes;
import com.newatlanta.repackaged.java.nio.file.attribute.DosFileAttributes;
import com.newatlanta.repackaged.java.nio.file.attribute.FileStoreSpaceAttributes;
import com.newatlanta.repackaged.java.nio.file.attribute.FileTime;
import com.newatlanta.repackaged.java.nio.file.attribute.PosixFileAttributes;
import com.newatlanta.repackaged.java.nio.file.attribute.PosixFilePermission;
import com.newatlanta.repackaged.java.nio.file.attribute.UserPrincipal;

public class GaeFileAttributesTestCase extends GaeVfsTestCase {

    @Test
    public void testGaeDirectory() throws IOException {
        Path path = Paths.get( "/attributeTest" ).createDirectory();
        assertTrue( path.exists() );
        BasicFileAttributes attr = Attributes.readBasicFileAttributes( path );
        assertTrue( attr.isDirectory() );
        assertFalse( attr.isRegularFile() );
        FileTime lastModifiedTime = attr.lastModifiedTime();
        assertNotNull( lastModifiedTime );
        assertFalse( lastModifiedTime.toMillis() == 0 );
        assertEquals( 0, attr.size() );
        assertNotSupported( attr );
    }

    @Test
    public void testLocalDirectory() throws IOException {
        Path path = Paths.get( "images" );
        assertTrue( path.exists() );
        BasicFileAttributes attr = Attributes.readBasicFileAttributes( path );
        assertTrue( attr.isDirectory() );
        assertFalse( attr.isRegularFile() );
        FileTime lastModifiedTime = attr.lastModifiedTime();
        assertNotNull( lastModifiedTime );
        assertFalse( lastModifiedTime.toMillis() == 0 );
        assertEquals( 0, attr.size() );
        assertNotSupported( attr );
    }

    @Test
    public void testGaeFile() throws IOException {
        // TODO: this will fail until GaePath.copyTo() is supported
        Path path = Paths.get( "images/small.jpg" ).copyTo( Paths.get( "images/test.jpg" ) );
        assertTrue( path.exists() );
        BasicFileAttributes attr = Attributes.readBasicFileAttributes( path );
        assertFalse( attr.isDirectory() );
        assertTrue( attr.isRegularFile() );
        FileTime lastModifiedTime = attr.lastModifiedTime();
        assertNotNull( lastModifiedTime );
        assertFalse( lastModifiedTime.toMillis() == 0 );
        assertEquals( 28359, attr.size() );
        assertNotSupported( attr );
    }

    @Test
    public void testLocalFile() throws IOException {
        Path path = Paths.get( "images/small.jpg" );
        assertTrue( path.exists() );
        BasicFileAttributes attr = Attributes.readBasicFileAttributes( path );
        assertFalse( attr.isDirectory() );
        assertTrue( attr.isRegularFile() );
        FileTime lastModifiedTime = attr.lastModifiedTime();
        assertNotNull( lastModifiedTime );
        assertFalse( lastModifiedTime.toMillis() == 0 );
        assertEquals( 28359, attr.size() );
        assertNotSupported( attr );
    }

    @Test
    public void testNonExistingPath() throws IOException {
        Path path = Paths.get( "doesNotExist" );
        assertFalse( path.exists() );
        BasicFileAttributes attr = Attributes.readBasicFileAttributes( path );
        assertFalse( attr.isDirectory() );
        assertFalse( attr.isRegularFile() );
        assertNull( attr.lastModifiedTime() );
        assertEquals( 0, attr.size() );
        assertNotSupported( attr );
    }

    private static void assertNotSupported( BasicFileAttributes attr ) {
        assertNull( attr.creationTime() );
        assertNull( attr.fileKey() );
        assertFalse( attr.isOther() );
        assertFalse( attr.isSymbolicLink() );
        assertNull( attr.lastAccessTime() );
    }

    @Test
    public void testSetTimes() throws IOException {
        Path path = Paths.get( "test.txt" ).createFile();
        long currentTime = System.currentTimeMillis();
        Attributes.setLastModifiedTime( path, FileTime.fromMillis( currentTime ) );
        assertEquals( currentTime, Attributes.readBasicFileAttributes( path ).lastModifiedTime().toMillis() );
        Attributes.setLastAccessTime( path, FileTime.fromMillis( currentTime ) ); // does nothing
    }

    @Test
    public void testAttributesClass() throws IOException {
        Path path = Paths.get( "test.txt" ).createFile();

        try {
            @SuppressWarnings("unused")
            List<AclEntry> aclList = Attributes.getAcl( path );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            Attributes.setAcl( path, new ArrayList<AclEntry>() );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            @SuppressWarnings("unused")
            UserPrincipal owner = Attributes.getOwner( path );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            Attributes.setOwner( path, null );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            @SuppressWarnings("unused")
            DosFileAttributes dosAttrs = Attributes.readDosFileAttributes( path );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            @SuppressWarnings("unused")
            PosixFileAttributes posixAttrs = Attributes.readPosixFileAttributes( path );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        try {
            Attributes.setPosixFilePermissions( path, new HashSet<PosixFilePermission>() );
            fail( "expected UnsupportedOperationException" );
        } catch ( UnsupportedOperationException e ) {
        }

        // this one should actually work, needs GaePath.getFileStore() to be implemented
        FileStoreSpaceAttributes fsAttrs = Attributes.readFileStoreSpaceAttributes( path.getFileStore() );
    }
}


text:
/*
 * index.js: Top-level include for the `system.json` module.
 *
 * (C) 2010, Nodejitsu Inc.
 *
 */

//
// Expose core system.json algorithms.
//
exports.dependencies       = require('./dependencies');
exports.lifecycle          = require('./lifecycle');
exports.remoteDependencies = require('./remote-dependencies');
exports.runlist            = require('./runlist');
exports.validate           = require('./validate');
exports.vars               = require('./vars');

//
// Alias `remoteDependencies` for the sake of my fingers.
//
exports.remote = exports.remoteDependencies;


text:
namespace dragon {

DEPLOY_CPU(DenseConcat);
#ifdef WITH_CUDA
DEPLOY_CUDA(DenseConcat);
#endif
OPERATOR_SCHEMA(DenseConcat).NumInputs(2).NumOutputs(1);

template <class Context> template <typename T>
void DenseConcatGradientOp<Context>::RestoreX1() {
    CHECK_GT(growth_rate, 0) << "\nInvalid growth rate, please preset it.";
    this->concat_dims = input(-1).dims();
    this->y_concat_dim = this->concat_dims[this->axis];
    this->outer_dim = input(-1).count(0, this->axis);
    this->inner_dim = input(-1).count(this->axis + 1);
    this->concat_dims[this->axis] -= growth_rate;
    input(0).Reshape(this->concat_dims);
    this->x_concat_dim = input(0).dim(this->axis);
    TIndex count = input(0).count();
    auto* Ydata = input(-2).template data<T, Context>();
    auto* Xdata = input(0).template mutable_data<T, Context>();
    kernel::ConcatGrad<T, Context>(count,
                         this->outer_dim,
                         this->inner_dim,
                      this->x_concat_dim,
                      this->y_concat_dim,
                                       0,
                                   Ydata,
                                   Xdata,
                                 &ctx());
}

template <class Context>
void DenseConcatGradientOp<Context>::ElimateCorruption() {
    Set<string> all_heads;
    queue<int> safe_heads;
    Tensor* head = ws()->GetTensor("/opt/mirror_stage/head");
    string* head_data = head->mutable_data<string, CPUContext>();
    for (int i = 0; i < head->count(); i++) all_heads.insert(head_data[i]);

    //  sub-graph run
    if (input(0).is_corrupted() && !all_heads.count(input(0).name())) {
        //  pre-process
        LOG(DEBUG) << "Tensor(" << input(0).name() << ") is corrupted, recompute...  ";
        for (int i = 0; i < head->count(); i++) {
            bool safe = true;
            for (int j = 0; j < InputSize(); j++)
                if (head_data[i] == input(j).name()) safe = false;
            if (safe) safe_heads.push(i);
        }
        int idx = safe_heads.front();
        safe_heads.pop();
        Tensor* buffer = ws()->GetTensor("/opt/mirror_stage/buffer_" + dragon_cast<string, int>(idx));
        input(0).Move(buffer->memory());
        head_data[idx] = input(0).name();
        if (input(-2).template IsType<float>()) RestoreX1<float>();
#ifdef WITH_CUDA_FP16
        else if (input(-2).template IsType<float16>()) RestoreX1<float16>();
#endif
        else LOG(FATAL) << "Unsupported input types.";
        //  post-process
        if (input(0).memory() != buffer->memory()) buffer->Move(input(0).memory());
    }

    //  check available head
    while (!safe_heads.empty()) safe_heads.pop();
    all_heads.clear();
    for (int i = 0; i < head->count(); i++) {
        bool safe = true;
        for (int j = 0; j < InputSize(); j++)
            if (head_data[i] == input(j).name()) safe = false;
        if (safe) safe_heads.push(i);
        all_heads.insert(head_data[i]);
    }

    //  pre-process
    for (int i = 0; i < OutputSize(); i++) {
        if (output(i)->is_corrupted()) {
            bool inplace_flag = false;
            for (int j = 0; j < InputSize(); j++)
                if (output(i)->name() == input(j).name()) inplace_flag = true;
            if (inplace_flag || all_heads.count(output(i)->name())) continue;    //  skip to use new buffer
            CHECK(!safe_heads.empty())
                << "\nAt most (" << safe_heads.size() << " [safe] / "
                << all_heads.size() << " [total] can be used for corrupted output in "
                << "(" << name() << ", " << type() << "), "
                << "\nadd WORKSPACE_MAX_CORRUPTED_SIZE for more powerful mirror stage ?";
            int idx = safe_heads.front();
            safe_heads.pop();
            Tensor* buffer = ws()->GetTensor("/opt/mirror_stage/buffer_" + dragon_cast<string, int>(idx));
            output(i)->Move(buffer->memory());
            head_data[idx] = output(i)->name();
        }
    }
}

DEPLOY_CPU(DenseConcatGradient);
#ifdef WITH_CUDA
DEPLOY_CUDA(DenseConcatGradient);
#endif
OPERATOR_SCHEMA(DenseConcatGradient).NumInputs(4).NumOutputs(2);

class GetDenseConcatGradient : public GradientMakerBase {
 public:
    GRADIENT_MAKER_CTOR(GetDenseConcatGradient);
    vector<OperatorDef> MakeDefs() override {
        return SingleDef(def.type() + "Gradient", "",
            vector<string> {I(0), I(1), O(0), GO(0)},
            vector<string> {GI(0), GI(1)});
    }
};
REGISTER_GRADIENT(DenseConcat, GetDenseConcatGradient);

}   // namespace dragon


text:
package com.dotosoft.dotoquiz.tools.config;

import java.io.FileWriter;
import java.io.InputStream;
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Paths;

import org.apache.commons.beanutils.BeanUtils;
import org.yaml.snakeyaml.Yaml;

import com.dotosoft.dotoquiz.config.Configuration;

public class Settings {

	private Yaml yaml = new Yaml();

	private Configuration configuration;
	private StructureConfig structure;
	private APIConfig api;

	private ImageConfig imageConfig;

	private String fileconfig;

	private String command;
	private String dataType;
	private String imageHostingType;

	private String syncDataFile;
	private String syncDataFolder;
	private String uploadDataFolder;

	private boolean replaced;

	public String getUploadDataFolder() {
		return uploadDataFolder;
	}

	public void setUploadDataFolder(String uploadDataFolder) {
		this.uploadDataFolder = uploadDataFolder;
	}

	public ImageConfig getImageConfig() {
		return imageConfig;
	}

	public void setImageConfig(ImageConfig imageConfig) {
		this.imageConfig = imageConfig;
	}

	public String getFileconfig() {
		return fileconfig;
	}

	public void setFileconfig(String fileconfig) {
		this.fileconfig = fileconfig;
	}

	public boolean getReplaced() {
		return replaced;
	}

	public void setReplaced(boolean replaced) {
		this.replaced = replaced;
	}

	public void setCommand(String command) {
		this.command = command;
	}

	public String getCommand() {
		return command;
	}

	public StructureConfig getStructure() {
		return structure;
	}

	public void setStructure(StructureConfig structure) {
		this.structure = structure;
	}

	public APIConfig getApi() {
		return api;
	}

	public void setApi(APIConfig api) {
		this.api = api;
	}

	public Configuration getConfiguration() {
		return configuration;
	}

	public void setConfiguration(Configuration configuration) {
		this.configuration = configuration;
	}

	public String getApplicationType() {
		return command;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public String getImageHostingType() {
		return imageHostingType;
	}

	public void setImageHostingType(String imageHostingType) {
		this.imageHostingType = imageHostingType;
	}

	public String getSyncDataFile() {
		return syncDataFile;
	}

	public void setSyncDataFile(String syncDataFile) {
		this.syncDataFile = syncDataFile;
	}

	public String getSyncDataFolder() {
		return syncDataFolder;
	}

	public void setSyncDataFolder(String syncDataFolder) {
		this.syncDataFolder = syncDataFolder;
	}

	public boolean loadSettings(String args[]) {
		try {
			if (args.length != 2) {
				return false;
			}

			fileconfig = args[1];
			InputStream in = Files.newInputStream(Paths.get(fileconfig));
			Settings setting = yaml.loadAs(in, Settings.class);
			BeanUtils.copyProperties(this, setting);
			command = args[0];
		} catch (Exception ex) {
			ex.printStackTrace();
			return false;
		}
		return true;
	}

	public boolean saveSettings() {
		try {
			Writer writer = new FileWriter(fileconfig);
			yaml.dump(this, writer);
			writer.close();
		} catch (Exception ex) {
			ex.printStackTrace();
			return false;
		}
		return true;
	}
}


text:
package util

import "strings"

func SlaceContains(slice []string, item string) bool {
	set := make(map[string]struct{}, len(slice))
	for _, s := range slice {
		set[s] = struct{}{}
	}

	_, ok := set[item]
	return ok
}

func SliceIndex(limit int, predicate func(i int) bool) int {
	for i := 0; i < limit; i++ {
		if predicate(i) {
			return i
		}
	}
	return -1
}

func SliceErase(a []string, t string) []string {
	i := SliceIndex(len(a), func(i int) bool {
		return strings.EqualFold(a[i], t)
	})
	return SliceEraseByIndex(a, i)
}

func SliceEraseByIndex(a []string, index int) []string {
	if index > -1 {
		copy(a[index:], a[index+1:])
		return a[:len(a)-1]
	}
	return a
}


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Trans. Br. mycol. Soc. 25: 170 (1941)

#### Original name
Nectria applanata Fr., 1870

### Remarks
null


text:
externalurl: http://simonvanderveldt.nl/boot2docker-on-xhyve/
author: Simon van der Veldt
category: blog
title: "boot2docker on xhyve"
---
xhyve is a new hypervisor in the vein of KVM on Linux and bhyve on BSD. It's actually a port of BSD's bhyve to OS X.
It's more similar to KVM than to Virtualbox in that it's minimal and commandline only which makes it a good fit for an always running virtual machine like boot2docker on OS X.
This post documents the steps to get boot2docker running within xhyve and contains some quick benchmarks as well to compare xhyve's performance with Virtualbox.


text:
namespace iox
{
namespace capro
{
class CaproMessage;
}
namespace gw
{
class InterfacePort;

/// @brief Discover the gateway
template <typename Impl_T = GatewayBase>
class GatewayDiscovery
{
  public:
    using CaproMessage = capro::CaproMessage;

    /// @brief Constructor for discovering gateway based on type of interface
    /// @param[in] f_interface Type of interface
    explicit GatewayDiscovery(const capro::Interfaces f_interface) noexcept
        : m_impl(f_interface)
    {
    }

    /// @brief Get function for type of capro message - service or event or field
    /// @param[in] msg Type of capro message
    bool getCaproMessage(CaproMessage& msg) noexcept
    {
        return m_impl.getCaProMessage(msg);
    }

  protected:
    // needed for unit testing
    explicit GatewayDiscovery(Impl_T interfacePortImpl) noexcept
        : m_impl(interfacePortImpl)
    {
    }

  private:
    Impl_T m_impl;
};
} // namespace gw
} // namespace iox

#endif // IOX_POSH_GW_GATEWAY_DISCOVERY_HPP


text:
package org.ujorm.wicket.component.grid;

import org.apache.wicket.Component;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.ujorm.Key;
import org.ujorm.Ujo;
import org.ujorm.core.KeyRing;
import org.ujorm.wicket.CssAppender;

/**
 * Key column for a boolean data type
 * @author Pavel Ponec
 * @param <U extends Ujo>
 *            The Model object type
 */
public class KeyColumnBoolean<U extends Ujo> extends KeyColumn<U, Boolean> {

    private static final long serialVersionUID = 1L;

    /** Default CSS class for an OK value */
    protected static String DEFAULT_LOGICAL_CLASS = "logical";
    /** Default CSS class for an {@code true} value */
    protected static String DEFAULT_CSS_AFFIRMATIVE_CLASS = "ok";

    /** Class for the TRUE value */
    protected final String cssAffirmativeClass;

    public KeyColumnBoolean(Key<U,?> key, Key<U,?> keySortable, String cssClass) {
        this(KeyRing.<U>of(key), KeyRing.<U>of(keySortable), cssClass, DEFAULT_CSS_AFFIRMATIVE_CLASS);
    }

    public KeyColumnBoolean(KeyRing<U> key, KeyRing<U> keySortable, String cssClass, String cssAffirmativeClass) {
        super(key, keySortable);
        setCssClass(cssClass);
        this.cssAffirmativeClass = cssAffirmativeClass;
    }

    /** Create a Value component */
    @Override
    protected IModel<?> createValueModel(final U ujo) {
        final Object value = keySerializable.getFirstValue(ujo);
        String result = value == null
                ? ""
                : Boolean.TRUE.equals(value)
                ? "ok"
                : "-";
        return Model.of(result);
    }

    /** Append the CSS class */
    @Override
    protected void appendCssClass(Component value, U ujo) {
        super.appendCssClass(value, ujo);

        if (cssAffirmativeClass != null
        &&  Boolean.TRUE.equals(keySerializable.getFirstValue(ujo))) {
            value.add(new CssAppender(cssAffirmativeClass));
        }
    }

    /** Returns a CSS class of the {@code true} value */
    public String getCssAffirmativeClass() {
        return cssAffirmativeClass;
    }

    // =============== STATIC FACTORY METHODS ===============

    /**
     * A factory method where a default key {@link #getCssAffirmativeClass()} have got value {@link #DEFAULT_CSS_AFFIRMATIVE_CLASS}
     * @param key Domain Key
     * @param sorted A sorting request
     * @return New instance of the KeyColumn class
     */
    public static <U extends Ujo, T> KeyColumn<U,T> of(Key<U,T> key, boolean sorted) {
        return of(key, sorted, DEFAULT_CSS_AFFIRMATIVE_CLASS);
    }

    /**
     * A factory method
     * @param key Domain Key
     * @param sorted Sorted column
     * @param cssAffirmativeClass Class for a value {@code Boolean.{@code true}} where a default value is {@link #DEFAULT_CSS_AFFIRMATIVE_CLASS}.
     * @return New instance of the KeyColumn class
     */
    public static <U extends Ujo, T> KeyColumn<U,T> of(Key<U,T> key, boolean sorted, String cssTrueClass) {
        final KeyRing serializableKey = KeyRing.of(key);
        return new KeyColumnBoolean
                ( serializableKey
                , sorted ? serializableKey : null
                , DEFAULT_LOGICAL_CLASS
                , cssTrueClass);
    }

    /**
     * A factory method
     * @param key Domain Key
     * @param sort Key of sorting
     * @param cssAffirmativeClass Class for a value {@code Boolean.TRUE} where a default value is {@link #DEFAULT_CSS_AFFIRMATIVE_CLASS}.
     * @return
     */
    public static <U extends Ujo, T> KeyColumn<U,T> of(Key<U,T> key, Key<U,T> sort, String cssTrueClass) {
        return new KeyColumnBoolean
                ( KeyRing.of(key)
                , KeyRing.of(sort)
                , DEFAULT_LOGICAL_CLASS
                , cssTrueClass);
    }

}


text:
{% extends "officehours/base.html" %}
{% load crispy_forms_tags %}

{% block content %}

Get in touch

Need help or have feedback for this app?
       Contact us using the button below:

      Get in Touch

{% endblock %}


text:
package com.fksm.flume.interceptor;

import com.alibaba.fastjson.JSON;
import com.fksm.common.dto.*;
import com.fksm.common.util.Constants;
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import org.apache.flume.Context;
import org.apache.flume.Event;
import org.apache.flume.interceptor.Interceptor;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CleanAndToJsonInterceptor implements Interceptor {

    private static final Logger logger = LoggerFactory.getLogger(CleanAndToJsonInterceptor.class);

    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss.SSS");

    private Pattern uuid;
    private Pattern ip;
    private Pattern time;

    private static Pattern number = Pattern.compile("\\d{3}");

    private CleanAndToJsonInterceptor(Pattern uuid,Pattern ip, Pattern time) {
        this.uuid = uuid;
        this.ip = ip;
        this.time = time;
    }

    @Override
    public void initialize() {
        // no-op
    }

    @Override
    public Event intercept(Event event) {
        if (event == null) {
            return null;
        }
        try {
            String e_b = new String(event.getBody(), Charsets.UTF_8);
            List<MessageDto> data = doReg(e_b);
            if (data == null || data.size() <= 0) {
                logger.warn("get none match data !!!");
                return null;
            }
            //toJson
            String res = JSON.toJSONString(data);
            logger.info("get json result : {} from log.", e_b);
            event.setBody(res.getBytes(Charsets.UTF_8));
            return event;
        } catch (Exception e) {
            logger.error("error get result : {} from log.", e);
            return null;
        }
    }

    @Override
    public List<Event> intercept(List<Event> events) {
        List<Event> out = Lists.newArrayList();
        for (Event event : events) {
            Event outEvent = intercept(event);
            if (outEvent != null) {
                out.add(outEvent);
            }
        }
        return out;
    }

    @Override
    public void close() {
        // no-op
    }

    public static class Builder implements Interceptor.Builder {

        private Pattern uuid;
        private Pattern ip;
        private Pattern time;

        @Override
        public void configure(Context context) {
            uuid = Pattern.compile(context.getString(Constants.REGEX_UUID, ""), Pattern.MULTILINE);
            ip = Pattern.compile(context.getString(Constants.REGEX_IP, ""), Pattern.MULTILINE);
            time = Pattern.compile(context.getString(Constants.REGEX_TIME, ""), Pattern.MULTILINE);
        }

        @Override
        public Interceptor build() {
            logger.info(String.format("Creating CleanAndToJsonInterceptor: uuid=%s,ip=%s, time=%s", uuid, ip, time));
            return new CleanAndToJsonInterceptor(uuid, ip, time);
        }
    }

    /**
     * do rege
     * visitor : 123.233.220.245 start visit service : 30a09c46-7d2c-485c-b9e0-1633674b2b04 in server : 171.9.80.67 with request id : 2eac609b-e9cf-41c7-9dcd-c28eba2b6c5c at time : 2016-04-26 10:42:40:243
     * server : 171.9.80.67 response for request : 2eac609b-e9cf-41c7-9dcd-c28eba2b6c5c at time : 2016-04-26 10:42:40:244 and the response code is : 300
     * @param body
     * @return
     */
    public List<MessageDto> doReg(String body){
        List<MessageDto> dtos = new ArrayList<>();
        //request_id -> time
        List<CallerInformation> callerInformations = new ArrayList<>();
        List<ServiceInformation> serviceInformations = new ArrayList<>();
        List<ResponseTime> responseTimes = new ArrayList<>();
        List<ResponseParameters> responseParameterses = new ArrayList<>();
        String[] lines = body.split("\n");
        logger.debug("read : {} from the logs.", lines.length);
        for (String line: lines){
            logger.debug("the line : {} ", line);
            System.out.println("--------------------uuidStr------------------------->" + uuid.pattern());
            System.out.println("--------------------ipStr------------------------->" + ip.pattern());
            System.out.println("--------------------uuidStr------------------------->" + time.pattern());
            Matcher uuidMatcher = uuid.matcher(line);
            Matcher ipMatcher = ip.matcher(line);
            Matcher timeMatcher = time.matcher(line);
            if (uuidMatcher.find() && timeMatcher.find()){
                // is response
                if(line.indexOf("response for request") > 0){
                    String server_ip = "";
                    if (ipMatcher.find()) {
                        //visitor ip
                        server_ip = ipMatcher.group();
                    }
                    //request_id
                    String request_id = uuidMatcher.group();
                    //service_id
                    String service_id = "";
                    if(uuidMatcher.find()){
                        service_id = uuidMatcher.group();
                    }
                    //ResponseTime
                    //request time
                    String begin_time = timeMatcher.group();
                    //response time
                    String end_time = "";
                    if(timeMatcher.find()){
                        end_time = timeMatcher.group();
                    }
                    //ResponseParameters
                    //response code
                    String response_code = "";
                    Matcher matcher = number.matcher(line);
                    int cnt = 0;
                    while (matcher.find()){
                        if(cnt==10)
                            response_code = matcher.group();
                        cnt ++;
                    }
                    responseParameterses.add(ResponseParameters.build(server_ip, service_id, request_id, Integer.parseInt(response_code), DateTime.parse(begin_time, formatter).getMillis()));
                    responseTimes.add(ResponseTime.build(server_ip, service_id, request_id, DateTime.parse(begin_time, formatter).getMillis(), DateTime.parse(end_time, formatter).getMillis()));
                } else {// is request
                    String caller_ip = "";
                    if (ipMatcher.find()) {
                        //visitor ip
                        caller_ip = ipMatcher.group();
                    }
                    //ServiceInformation
                    //server ip
                    String server_ip = "";
                    if(ipMatcher.find()){
                        server_ip = ipMatcher.group();
                    }
                    //service_id
                    String service_id = uuidMatcher.group();
                    //request_id
                    String request_id = "";
                    if(uuidMatcher.find()){
                        request_id = uuidMatcher.group();
                    }
                    //request time
                    String begin_time = timeMatcher.group();
                    callerInformations.add(CallerInformation.build(server_ip, service_id, request_id, caller_ip, DateTime.parse(begin_time, formatter).getMillis()));
                    serviceInformations.add(ServiceInformation.build(service_id, request_id, server_ip, DateTime.parse(begin_time, formatter).getMillis()));
                }
            }
        }
        if(callerInformations.size()>0)
            dtos.add(MessageDto.build(Constants.TYPE_CALLER_INFO,callerInformations));
        if(serviceInformations.size()>0)
            dtos.add(MessageDto.build(Constants.TYPE_SERVICE_INFO,serviceInformations));
        if(responseParameterses.size()>0)
            dtos.add(MessageDto.build(Constants.TYPE_RESP_PARAM,responseParameterses));
        if(responseTimes.size()>0)
            dtos.add(MessageDto.build(Constants.TYPE_RESP_TIME,responseTimes));
        return dtos;
    }
}


text:
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

/* PftMask.cs --
 * Ars Magna project, http://arsmagna.ru
 * -------------------------------------------------------
 * Status: poor
 */

#region Using directives

using System.Linq;

using AM;
using AM.Collections;
using AM.Text;

using CodeJam;

using JetBrains.Annotations;

using MoonSharp.Interpreter;

#endregion

namespace ManagedIrbis.Pft.Infrastructure
{
    //
    // Форматный выход: Сравнить заданное значение с маской
    // (сравнение по маске)
    // &uf('=!<маска>!<значение>')
    // ! – уникальный символ двухстороннего ограничения
    // (может быть любым символом).
    // Маска может содержать принятые символы маскирования * и ?.
    // В общем случае маска может содержать несколько масок,
    // отделенных друг от друга символом вертикальной черты (|).
    // Форматный выход возвращает: 1 – в случае положительного
    // результата сравнения; 0 – в случае отрицательного.
    //

    //
    // Examples
    //
    // ----------------------------------
    // | Mask      | Value     | Result |
    // | ----------|-----------|--------|
    // | *         |           | 1      |
    // | ?         |           | 0      |
    // | Hello     | Hello     | 1      |
    // | Hello     | hello     | 0      |
    // | Hello*    | Hello     | 1      |
    // | Hello?    | Hello     | 0      |
    // | Hel*      | Hello     | 1      |
    // | He??o     | Hello     | 1      |
    // | He??o     | Hell      | 0      |
    // ----------------------------------
    //

    /// <summary>
    ///
    /// </summary>
    [PublicAPI]
    [MoonSharpUserData]
    public sealed class PftMask
    {
        #region Nested classes

        class Mask
        {
            #region Properties

            // ReSharper disable MemberCanBePrivate.Local
            // ReSharper disable UnusedAutoPropertyAccessor.Local
            // ReSharper disable AutoPropertyCanBeMadeGetOnly.Local

            public bool Active { get; set; }

            [NotNull]
            internal string Value { get; private set; }

            [NotNull]
            public TextNavigator Navigator { get; private set; }

            // ReSharper restore AutoPropertyCanBeMadeGetOnly.Local
            // ReSharper enable UnusedAutoPropertyAccessor.Local
            // ReSharper restore MemberCanBePrivate.Local

            #endregion

            #region Construction

            /// <summary>
            /// Constructor.
            /// </summary>
            public Mask
                (
                    [NotNull] string value
                )
            {
                Active = true;
                Value = value;
                Navigator = new TextNavigator(value);
            }

            #endregion
        }

        #endregion

        #region Properties

        /// <summary>
        /// Alternative masks.
        /// </summary>
        [NotNull]
        public NonNullCollection<string> Alternatives { get; private set; }

        #endregion

        #region Construction

        /// <summary>
        /// Constructor.
        /// </summary>
        public PftMask()
        {
            Alternatives = new NonNullCollection<string>();
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        public PftMask
            (
                [NotNull] string specification
            )
        {
            Code.NotNull(specification, "specification");

            Alternatives = new NonNullCollection<string>();
            string[] parts = StringUtility.SplitString(specification, "|");
            Alternatives.AddRange(parts);
        }

        #endregion

        #region Public methods

        /// <summary>
        /// Whether the text matches one of the masks.
        /// </summary>
        public bool Match
            (
                [NotNull] string text
            )
        {
            Code.NotNull(text, "text");

            Mask[] masks = Alternatives.Select(_ => new Mask(_)).ToArray();
            TextNavigator navigator = new TextNavigator(text);

            while (true)
            {
                Mask[] activeMasks = masks.Where(_ => _.Active).ToArray();
                if (activeMasks.Length == 0)
                {
                    return navigator.IsEOF;
                }

                char valueChar = navigator.ReadChar();
                if (valueChar == TextNavigator.EOF)
                {
                    foreach (Mask mask in activeMasks)
                    {
                        char maskChar = mask.Navigator.ReadChar();
                        switch (maskChar)
                        {
                            case TextNavigator.EOF:
                            case '*':
                                goto ALL_DONE;

                            default:
                                return false;
                        }
                    }
                }

                foreach (Mask mask in activeMasks)
                {
                    char maskChar = mask.Navigator.ReadChar();
                    switch (maskChar)
                    {
                        case TextNavigator.EOF:
                            mask.Active = false;
                            continue;

                        case '?':
                            break;

                        case '*':
                            goto ALL_DONE;

                        default:
                            if (maskChar != valueChar)
                            {
                                mask.Active = false;
                            }
                            break;
                    }
                }
            }

            ALL_DONE: return true;
        }

        #endregion
    }
}