text:
using System;
using System.IO;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
#pragma warning disable 1591

namespace TWCore.Serialization.RawSerializer
{
    public partial class SerializersTable
    {
        #region Expressions - Int
        private static readonly MethodInfo IntValueProperty = typeof(int?).GetProperty("Value", BindingFlags.Instance | BindingFlags.Public)?.GetMethod;

        internal static Expression WriteIntExpression(Expression value, ParameterExpression serTable)
        {
            var intParam = Expression.Parameter(typeof(int));
            var block = Expression.Block(new[] { intParam },
                Expression.Assign(intParam, value),
                Expression.IfThenElse(
                    Expression.Equal(intParam, Expression.Constant(default(int))),
                    Expression.Call(serTable, WriteByteMethodInfo, Expression.Constant(DataBytesDefinition.IntDefault)),
                    Expression.Call(serTable, WriteDefIntMInfo, Expression.Constant(DataBytesDefinition.Int), intParam)));
            return block.Reduce();
        }
        internal static Expression WriteNulleableIntExpression(Expression value, ParameterExpression serTable)
        {
            var intParam = Expression.Parameter(typeof(int?));
            var block = Expression.Block(new[] { intParam },
                Expression.Assign(intParam, value),
                Expression.IfThenElse(
                    Expression.Equal(intParam, Expression.Constant(null, typeof(int?))),
                    Expression.Call(serTable, WriteByteMethodInfo, Expression.Constant(DataBytesDefinition.ValueNull)),
                    WriteIntExpression(Expression.Call(intParam, IntValueProperty), serTable)));
            return block.Reduce();
        }
        #endregion

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(decimal value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.DecimalDefault);
            else
                WriteDefDecimal(DataBytesDefinition.Decimal, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(double value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.DoubleDefault);
            else
                WriteDefDouble(DataBytesDefinition.Double, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(float value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.FloatDefault);
            else
                WriteDefFloat(DataBytesDefinition.Float, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(long value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.LongDefault);
            else
                WriteDefLong(DataBytesDefinition.Long, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(ulong value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.ULongDefault);
            else
                WriteDefULong(DataBytesDefinition.ULong, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(int value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.IntDefault);
            else
                WriteDefInt(DataBytesDefinition.Int, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(uint value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.UIntDefault);
            else
                WriteDefUInt(DataBytesDefinition.UInt, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(short value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.ShortDefault);
            else
                WriteDefShort(DataBytesDefinition.Short, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(ushort value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.UShortDefault);
            else
                WriteDefUshort(DataBytesDefinition.UShort, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(byte value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.ByteDefault);
            else
                WriteDefByte(DataBytesDefinition.Byte, value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(sbyte value)
        {
            if (value == default)
                WriteByte(DataBytesDefinition.SByteDefault);
            else if (value == -1)
                WriteByte(DataBytesDefinition.SByteMinusOne);
            else
            {
                WriteByte(DataBytesDefinition.SByte);
                WriteSByte(value);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(decimal? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(double? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(float? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(long? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(ulong? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(int? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(uint? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(short? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(ushort? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(byte? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void WriteValue(sbyte? value)
        {
            if (value is null) WriteByte(DataBytesDefinition.ValueNull);
            else WriteValue(value.Value);
        }
    }

    public partial class DeserializersTable
    {
        [DeserializerMethod(DataBytesDefinition.Decimal, DataBytesDefinition.DecimalDefault, ReturnType = typeof(decimal))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public decimal StreamReadDecimal(byte type)
        {
            if (type == DataBytesDefinition.Decimal)
                return StreamReadDecimal();
            if (type == DataBytesDefinition.DecimalDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(decimal?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public decimal? StreamReadDecimalNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadDecimal(type);
        }

        [DeserializerMethod(DataBytesDefinition.Double, DataBytesDefinition.DoubleDefault, ReturnType = typeof(double))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public double StreamReadDouble(byte type)
        {
            if (type == DataBytesDefinition.Double)
                return StreamReadDouble();
            if (type == DataBytesDefinition.DoubleDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(double?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public double? StreamReadDoubleNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadDouble(type);
        }

        [DeserializerMethod(DataBytesDefinition.Float, DataBytesDefinition.FloatDefault, ReturnType = typeof(float))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public float StreamReadFloat(byte type)
        {
            if (type == DataBytesDefinition.Float)
                return StreamReadFloat();
            if (type == DataBytesDefinition.FloatDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(float?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public float? StreamReadFloatNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadFloat(type);
        }

        [DeserializerMethod(DataBytesDefinition.Long, DataBytesDefinition.LongDefault, ReturnType = typeof(long))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long StreamReadLong(byte type)
        {
            if (type == DataBytesDefinition.Long)
                return StreamReadLong();
            if (type == DataBytesDefinition.LongDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(long?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long? StreamReadLongNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadLong(type);
        }

        [DeserializerMethod(DataBytesDefinition.ULong, DataBytesDefinition.ULongDefault, ReturnType = typeof(ulong))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ulong StreamReadULong(byte type)
        {
            if (type == DataBytesDefinition.ULong)
                return StreamReadULong();
            if (type == DataBytesDefinition.ULongDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(ulong?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ulong? StreamReadULongNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadULong(type);
        }

        [DeserializerMethod(DataBytesDefinition.Int, DataBytesDefinition.IntDefault, ReturnType = typeof(int))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public int StreamReadInt(byte type)
        {
            if (type == DataBytesDefinition.Int)
                return StreamReadInt();
            if (type == DataBytesDefinition.IntDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(int?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public int? StreamReadIntNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull)
                return null;
            return StreamReadInt(type);
        }

        [DeserializerMethod(DataBytesDefinition.UInt, DataBytesDefinition.UIntDefault, ReturnType = typeof(uint))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public uint StreamReadUInt(byte type)
        {
            if (type == DataBytesDefinition.UInt)
                return StreamReadUInt();
            if (type == DataBytesDefinition.UIntDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(uint?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public uint? StreamReadUIntNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadUInt(type);
        }

        [DeserializerMethod(DataBytesDefinition.Short, DataBytesDefinition.ShortDefault, ReturnType = typeof(short))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public short StreamReadShort(byte type)
        {
            if (type == DataBytesDefinition.Short)
                return StreamReadShort();
            if (type == DataBytesDefinition.ShortDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(short?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public short? StreamReadShortNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadShort(type);
        }

        [DeserializerMethod(DataBytesDefinition.UShort, DataBytesDefinition.UShortDefault, ReturnType = typeof(ushort))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ushort StreamReadUShort(byte type)
        {
            if (type == DataBytesDefinition.UShort)
                return StreamReadUShort();
            if (type == DataBytesDefinition.UShortDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(ushort?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ushort? StreamReadUShortNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadUShort(type);
        }

        [DeserializerMethod(DataBytesDefinition.Byte, DataBytesDefinition.ByteDefault, ReturnType = typeof(byte))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public byte StreamReadByte(byte type)
        {
            if (type == DataBytesDefinition.Byte)
                return StreamReadByte();
            if (type == DataBytesDefinition.ByteDefault)
                return default;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(byte?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public byte? StreamReadByteNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadByte(type);
        }

        [DeserializerMethod(DataBytesDefinition.SByte, DataBytesDefinition.SByteDefault, DataBytesDefinition.SByteMinusOne, ReturnType = typeof(sbyte))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public sbyte StreamReadSByte(byte type)
        {
            if (type == DataBytesDefinition.SByte)
                return StreamReadSByte();
            if (type == DataBytesDefinition.SByteDefault)
                return default;
            if (type == DataBytesDefinition.SByteMinusOne)
                return -1;
            ThrowInvalidOperationException(type);
            return default;
        }
        [DeserializerMethod(ReturnType = typeof(sbyte?))]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public sbyte? StreamReadSByteNullable(byte type)
        {
            if (type == DataBytesDefinition.ValueNull) return null;
            return StreamReadSByte(type);
        }
    }
}


text:
require 'spec_helper'

describe 'layouts/_head' do
  before do
    stub_template 'layouts/_user_styles.html.haml' => ''
  end

  it 'escapes HTML-safe strings in page_title' do
    stub_helper_with_safe_string(:page_title)

    render

    expect(rendered).to match(%{content="foo" http-equiv="refresh"})
  end

  it 'escapes HTML-safe strings in page_description' do
    stub_helper_with_safe_string(:page_description)

    render

    expect(rendered).to match(%{content="foo" http-equiv="refresh"})
  end

  it 'escapes HTML-safe strings in page_image' do
    stub_helper_with_safe_string(:page_image)

    render

    expect(rendered).to match(%{content="foo" http-equiv="refresh"})
  end

  def stub_helper_with_safe_string(method)
    allow_any_instance_of(PageLayoutHelper).to receive(method)
      .and_return(%q{foo" http-equiv="refresh}.html_safe)
  end
end

redpajama_set_name: RedPajamaGithub


text:
import { GraphQLFieldConfigMap } from 'graphql';
import categoryQuery from './categories/categoryQuery';
import commentQuery from './comments/commentQuery';
import mediaQuery from './media/mediaQuery';
import pageQuery from './pages/pageQuery';
import postStatusQuery from './post-statuses/postStatusQuery';
import postTypeQuery from './post-types/postTypeQuery';
import postQuery from './posts/postQuery';
import revisionQuery from './revisions/revisionQuery';
import settingsQuery from './settings/settingsQuery';
import tagQuery from './tags/tagQuery';
import taxonomyQuery from './taxonomies/taxonomyQuery';
import userQuery from './users/userQuery';

export default <GraphQLFieldConfigMap<any, any>> {
    ...categoryQuery,
    ...commentQuery,
    ...mediaQuery,
    ...pageQuery,
    ...postStatusQuery,
    ...postTypeQuery,
    ...postQuery,
    ...revisionQuery,
    ...settingsQuery,
    ...tagQuery,
    ...taxonomyQuery,
    ...userQuery,
};


text:
<title>Zend Framework API Documentation</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta><link rel="stylesheet" href="css/black-tie/jquery-ui-1.8.2.custom.css" type="text/css"></link><link rel="stylesheet" href="css/jquery.treeview.css" type="text/css"></link><link rel="stylesheet" href="css/theme.css" type="text/css"></link>

API Documentation

Service/WindowsAzure/Diagnostics/ConfigurationInstance.php

Global

                      Classes

\Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.

category

Zend

copyright

Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)

license

New BSD License

package

Zend_Service_WindowsAzure

subpackage

Diagnostics

version

$Id$

\Zend_Service_WindowsAzure_Diagnostics_ConfigurationInstance
jump to top

Extends from

\Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract

category

Zend

copyright

Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)

license

New BSD License

package

Zend_Service_WindowsAzure

subpackage

Diagnostics

Properties

\Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources
                 = ''

DataSources Data sources
DataSources Data sources

Details

Type

\Zend_Service_WindowsAzure_Diagnostics_ConfigurationDataSources

magic

property

DataSources Data sources

Methods

__construct(

          )

        :
          void

Constructor

__get(
          string $name
          )

        :
          void

Magic overload for getting properties

Inherited from:
                    \Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract::__get()

Parameters

Name
Type
Description

$name
string
Name of the property

__set(
          string $name, string $value
          )

        :
          void

Magic overload for setting properties

Inherited from:
                    \Zend_Service_WindowsAzure_Diagnostics_ConfigurationObjectBaseAbstract::__set()

Parameters

Name
Type
Description

$name
string
Name of the property

$value
string
Value to set

loadXml(
          string $configurationXml
          )

        :
          void

Load configuration XML

Parameters

Name
Type
Description

$configurationXml
string
Configuration XML

toXml(

          )

        :
          string

Create configuration XML

Returns

Type
Description

string

Documentation was generated by DocBlox 0.13.3.


text:
package com.nagare.balkrishna.omkar.programminginterviewprepguide;

import org.junit.Test;

import static org.junit.Assert.*;

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * @see Testing documentation
 */
public class ExampleUnitTest {
    @Test
    public void addition_isCorrect() throws Exception {
        assertEquals(4, 2 + 2);
    }
}


text:
<?php

namespace Sunahip\UserBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class UsuarioType extends AbstractType
{

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);
        $builder
                ->add('email', 'email', array(
                    'required' => true,
                    'label' => 'Email',
                    'trim' => true,
                    'attr' => array(
                        "maxlength" => 50,
                        "onblur" => " validateEmail(this)"
                    )
                ))
                ->add('password', 'password', array(
                    'required' => true,
                    'label' => 'Contraseña',
                    'always_empty' => true,
                    'attr' => array(
                        "maxlength" => 8,
                        "onblur" => " validatePassword(this)"
                    )
                ))
                ->add('confirm', 'password', array(
                    'required' => true,
                    'mapped' => false,
                    'label' => 'Verificar contraseña',
                    'always_empty' => true,
                    'attr' => array(
                        "maxlength" => 8,
                        "onblur" => " validatePassword(this)"
                    )
                ))
                ->add('perfil', new PerfilType());
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(
                array(
                    'data_class' => 'Sunahip\UserBundle\Entity\SysUsuario',
                    'intention' => 'new_user'
                )
        );
    }

    public function getName()
    {
        return 'user_register';
    }

}


text:
/*
 * Copyright 2015 Scylla DB
 */

#pragma once

/// \cond internal

// cause all threads to invoke a full memory barrier
void systemwide_memory_barrier();

/// \endcond


text:
layout: page
title: Branch 55th Anniversary
date: 2016-05-24
author: Aaron Hansen
tags: weekly links, java
status: published
summary: Etiam eu nibh quis sapien.
banner: images/banner/meeting-01.jpg
booking:
  startDate: 09/17/2018
  endDate: 09/22/2018
  ctyhocn: HOUCYHX
  groupCode: B5A
published: true
---
Morbi bibendum sit amet mauris nec varius. Praesent suscipit tortor ante, non placerat sapien efficitur eu. Nunc maximus dictum tincidunt. Cras ultricies viverra justo. Vestibulum nec orci sed orci lobortis sollicitudin ac at velit. Morbi ornare, magna vitae rhoncus pulvinar, dolor nibh maximus libero, id tincidunt enim elit sed orci. Duis tristique neque leo, a aliquam purus facilisis porttitor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Proin hendrerit imperdiet nibh eget efficitur.

1 Nulla quis dui quis dolor sagittis placerat
1 Suspendisse a ligula id massa ornare accumsan ac non elit
1 Integer et magna eu nulla fermentum efficitur et in tellus.

Morbi vel arcu sed purus iaculis fermentum. Duis vulputate sodales pulvinar. Pellentesque consequat lacus id quam dignissim interdum. Curabitur et cursus lacus. Donec bibendum accumsan venenatis. Praesent quis tellus faucibus, ullamcorper turpis nec, laoreet neque. Pellentesque eleifend ut nisi a aliquam. Nulla non semper tortor. Praesent at mi egestas, sollicitudin massa eu, vestibulum tellus.


text:
package filodb.query.exec.rangefn

import com.typesafe.config.{Config, ConfigFactory}
import monix.execution.Scheduler.Implicits.global
import monix.reactive.Observable
import org.scalatest.{FunSpec, Matchers}
import org.scalatest.concurrent.ScalaFutures

import filodb.core.MetricsTestData
import filodb.core.query.{CustomRangeVectorKey, RangeVector, RangeVectorKey, ResultSchema}
import filodb.memory.format.{RowReader, ZeroCopyUTF8String}
import filodb.query._
import filodb.query.exec.TransientRow

class LabelReplaceSpec extends FunSpec with Matchers with ScalaFutures {

  val config: Config = ConfigFactory.load("application_test.conf").getConfig("filodb")
  val resultSchema = ResultSchema(MetricsTestData.timeseriesDataset.infosFromIDs(0 to 1), 1)
  val ignoreKey = CustomRangeVectorKey(
    Map(ZeroCopyUTF8String("ignore") -> ZeroCopyUTF8String("ignore")))

  val testKey1 = CustomRangeVectorKey(
    Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

  val testKey2 = CustomRangeVectorKey(
    Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

  val testSample: Array[RangeVector] = Array(
    new RangeVector {
      override def key: RangeVectorKey = testKey1

      override def rows: Iterator[RowReader] = Seq(
        new TransientRow(1L, 3.3d),
        new TransientRow(2L, 5.1d)).iterator
    },
    new RangeVector {
      override def key: RangeVectorKey = testKey2

      override def rows: Iterator[RowReader] = Seq(
        new TransientRow(3L, 100d),
        new TransientRow(4L, 200d)).iterator
    })

  val queryConfig = new QueryConfig(config.getConfig("query"))

  it("should replace label only when match is found in label replace") {
    val sampleKey1 = CustomRangeVectorKey(
      Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("demo.io:9090"),
        ZeroCopyUTF8String("job") -> ZeroCopyUTF8String("test")))
    val sampleKey2 = CustomRangeVectorKey(
      Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("demo.io:8080")))

    val sampleWithKey: Array[RangeVector] = Array(
      new RangeVector {
        override def key: RangeVectorKey = sampleKey1

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(1L, 3.3d),
          new TransientRow(2L, 5.1d)).iterator
      },
      new RangeVector {
        override def key: RangeVectorKey = sampleKey2

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(3L, 100d),
          new TransientRow(4L, 200d)).iterator
      })

    val expectedLabels = List(Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("demo.io new Label Value 90"),
      ZeroCopyUTF8String("job") -> ZeroCopyUTF8String("test")),
      Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("demo.io:8080"))) // will not be replaced

    val funcParams = Seq("instance", "$1 new Label Value $2", "instance", "(.*):90(.*)")
    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(sampleWithKey), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    //label_replace should not change rows
    sampleWithKey.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should add new label when dst_label does not exist") {
    val sampleKey1 = CustomRangeVectorKey(
      Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("Instance-100"),
        ZeroCopyUTF8String("job") -> ZeroCopyUTF8String("test")))

    val sampleWithKey: Array[RangeVector] = Array(
      new RangeVector {
        override def key: RangeVectorKey = sampleKey1

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(1L, 3.3d),
          new TransientRow(2L, 5.1d)).iterator
      },
      new RangeVector {
        override def key: RangeVectorKey = ignoreKey

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(3L, 100d),
          new TransientRow(4L, 200d)).iterator
      })

    val expectedLabels = List(Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("Instance-100"),
      ZeroCopyUTF8String("job") -> ZeroCopyUTF8String("test"),
      ZeroCopyUTF8String("instanceNew") -> ZeroCopyUTF8String("Instance-10-Instance-10")),
      Map(ZeroCopyUTF8String("ignore") -> ZeroCopyUTF8String("ignore")))

    val funcParams = Seq("instanceNew", "$1-$1", "instance", "(.*)\\d")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(sampleWithKey), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    sampleWithKey.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should not change sample when entire regex does not match") {
    val sampleKey1 = CustomRangeVectorKey(
      Map(ZeroCopyUTF8String("instance") -> ZeroCopyUTF8String("Instance-9090"),
        ZeroCopyUTF8String("job") -> ZeroCopyUTF8String("test")))

    val sampleWithKey: Array[RangeVector] = Array(
      new RangeVector {
        override def key: RangeVectorKey = sampleKey1

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(1L, 3.3d),
          new TransientRow(2L, 5.1d)).iterator
      },
      new RangeVector {
        override def key: RangeVectorKey = ignoreKey

        override def rows: Iterator[RowReader] = Seq(
          new TransientRow(3L, 100d),
          new TransientRow(4L, 200d)).iterator
      })

    val expectedLabels = sampleWithKey.toList.map(_.key.labelValues)
    val funcParams = Seq("instance", "$1", "instance", "(.*)9")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(sampleWithKey), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    sampleWithKey.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should validate invalid function params") {

    val funcParams = Seq("instance", "$1", "instance", "(.*)9(")

    the[IllegalArgumentException] thrownBy {
      val miscellaneousFunctionMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace,
        funcParams)
      miscellaneousFunctionMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    } should have message "Invalid Regular Expression for label_replace"

    the[IllegalArgumentException] thrownBy {
      val miscellaneousFunctionMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace,
        Seq("instance", "$1"))
      miscellaneousFunctionMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    } should have message "requirement failed: " +
      "Cannot use LabelReplace without function parameters: " +
      "instant-vector, dst_label string, replacement string, src_label string, regex string"

    the[IllegalArgumentException] thrownBy {
      val miscellaneousFunctionMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace,
        Seq("$instance", "$1", "instance", "(.*)9("))
      miscellaneousFunctionMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    } should have message "requirement failed: Invalid destination label name"
  }

  it("should do a full-string match and replace") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("destination-value-10")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("destination-value-20")))

    val funcParams = Seq("dst", "destination-value-$1", "src", "source-value-(.*)")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should not do a sub-string match") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

    val funcParams = Seq("dst", "destination-value-$1", "src", "value-(.*)")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should works with multiple groups and remove groups which do not exist from the replacement string") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("source-value-10 ")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("source-value-20 ")))

    val funcParams = Seq("dst", "$1-value-$2 $3$67", "src", "(.*)-value-(.*)")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should not overwrite the destination label if the source label does not exist") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

    val funcParams = Seq("dst", "value-$1", "nonexistent-src", "source-value-(.*)")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should overwrite destination label if the source label is empty but matched") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("value-")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("value-")))

    val funcParams = Seq("dst", "value-$1", "nonexistent-src", ".*")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should not overwrite the destination label if the source label is not matched") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10"),
      ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20"),
        ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

    val funcParams = Seq("dst", "value-$1", "src", "dummy-regex")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should drop labels that are set to empty values") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-10")),
      Map(ZeroCopyUTF8String("src") -> ZeroCopyUTF8String("source-value-20")))

    val funcParams = Seq("dst", "", "dst", ".*")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

  it("should remove duplicated identical output label sets") {

    val expectedLabels = List(Map(ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")),
      Map(ZeroCopyUTF8String("dst") -> ZeroCopyUTF8String("original-destination-value")))

    val funcParams = Seq("src", "", "", "")

    val labelVectorFnMapper = exec.MiscellaneousFunctionMapper(MiscellaneousFunctionId.LabelReplace, funcParams)
    val resultObs = labelVectorFnMapper(Observable.fromIterable(testSample), queryConfig, 1000, resultSchema)
    val resultLabelValues = resultObs.toListL.runAsync.futureValue.map(_.key.labelValues)
    val resultRows = resultObs.toListL.runAsync.futureValue.map(_.rows.map(_.getDouble(1)))

    resultLabelValues.sameElements(expectedLabels) shouldEqual true

    testSample.map(_.rows.map(_.getDouble(1))).zip(resultRows).foreach {
      case (ex, res) => {
        ex.zip(res).foreach {
          case (val1, val2) =>
            val1 shouldEqual val2
        }
      }
    }
  }

}


text:
/// <reference path="_references.js" />
(function (window) {
    "use strict";

    var hinata = {}

    hinata.insertAtCaret = function (areaId, text) {
        var txtarea = document.getElementById(areaId);
        var scrollPos = txtarea.scrollTop;
        var strPos = 0;
        var br = ((txtarea.selectionStart || txtarea.selectionStart === "0") ? "ff" : (document.selection ? "ie" : false));
        var range;
        if (br === "ie") {
            txtarea.focus();
            range = document.selection.createRange();
            range.moveStart("character", -txtarea.value.length);
            strPos = range.text.length;
        } else if (br === "ff") strPos = txtarea.selectionStart;

        var front = (txtarea.value).substring(0, strPos);
        var back = (txtarea.value).substring(strPos, txtarea.value.length);
        txtarea.value = front + text + back;
        strPos = strPos + text.length;
        if (br === "ie") {
            txtarea.focus();
            range = document.selection.createRange();
            range.moveStart("character", -txtarea.value.length);
            range.moveStart("character", strPos);
            range.moveEnd("character", 0);
            range.select();
        } else if (br === "ff") {
            txtarea.selectionStart = strPos;
            txtarea.selectionEnd = strPos;
            txtarea.focus();
        }
        txtarea.scrollTop = scrollPos;
    }

    hinata.charcount = function (str) {
        var len = 0;
        str = escape(str);
        for (var i = 0; i < str.length; i++, len++) {
            if (str.charAt(i) === "%") {
                if (str.charAt(++i) === "u") {
                    i += 3;
                    len++;
                }
                i++;
            }
        }
        return len;
    }

    window.hinata = hinata;
})(window);

(function ($, window, undefined) {
    "use strict";

    $.fn.extend({
        tabIndent: function (spaces) {
            if (!$(this).data("_keydownAttached")) {
                $(this).data("_keydownAttached", true);

                if (spaces === null || spaces === undefined) {
                    spaces = 4;
                }

                $(this).on("keydown", function(event) {
                    var keyCode = event.keyCode || event.which;

                    if (keyCode === 9) {
                        event.preventDefault();
                        var elem = event.target;
                        var val = elem.value;
                        var pos = elem.selectionStart;
                        var lines = elem.value.substring(0, pos).split("\n");
                        var lineText = lines[lines.length - 1];
                        if (event.shiftKey === false) {
                            var lineCharCount = hinata.charcount(lineText);
                            var spaceCount = spaces - (lineCharCount % spaces);
                            var putSpace = "";
                            for (var i = 0; i < spaceCount; i++) {
                                putSpace += " ";
                            }
                            elem.value = val.substr(0, pos) + putSpace + val.substr(pos, val.length);
                            elem.setSelectionRange(pos + spaceCount, pos + spaceCount);
                        } else {
                            var spaceRemoveCount = 0;
                            for (var j = 1; j <= spaces; j++) {
                                if (lineText.substr(lineText.length - 1, 1) === " ") {
                                    lineText = lineText.substr(0, lineText.length - 1);
                                    spaceRemoveCount = j;
                                } else {
                                    break;
                                }
                            }
                            elem.value = val.substr(0, pos - spaceRemoveCount) + val.substr(pos, val.length);
                            elem.setSelectionRange(pos - spaceRemoveCount, pos - spaceRemoveCount);
                        }
                    }
                });
            }
            return $(this);
        },

        typeCharacter: function (func) {
            if (!$(this).data("_keyupAttached")) {
                $(this).data("_keyupAttached", true);
                $(this).on("keyup", function (event) {
                    var keyCode = event.keyCode || event.which;
                    if (([9, 16, 17, 18, 19, 20, 27, 33, 34, 35, 36, 37, 38, 39, 40, 45, 91, 93, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 144, 145]).indexOf(keyCode) === -1) {
                        $(this).trigger("typeCharacter");
                    }
                });

                if (func) {
                    $(this).bind("typeCharacter", func);
                } else {
                    $(this).trigger("typeCharacter");
                }
            }
            return $(this);
        }
    });
})(jQuery, window);


text:
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.structuralsearch;

import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.structuralsearch.plugin.ui.Configuration;
import org.jetbrains.annotations.NotNull;

import static com.intellij.structuralsearch.PredefinedConfigurationUtil.*;

/**
 * @author Bas Leijdekkers
 */
final class JavaPredefinedConfigurations {
  @NotNull
  public static Configuration @NotNull [] createPredefinedTemplates() {
    return new Configuration[]{
      // Expression patterns
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.method.calls"), "method calls",
                                "'_Instance?.'MethodCall('_Parameter*)",
                                getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.new.expressions"), "new expressions",
                                "new 'Constructor('_Argument*)", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.lambdas"), "lambdas",
                                "('_Parameter*) -> {}", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.field.selections"), "field selections",
                                "'_Instance?.'Field", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.array.access"), "array access",
                                "'_Array['_Index]", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.assignments"), "assignments",
                                "'_Inst = '_Expr", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.casts"), "casts",
                                "('_Type)'_Expr", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.instanceof"), "instanceof",
                                "'_Expr instanceof '_Type", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.string.literals"), "string literals",
                                "\"'_String\"", getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.all.expressions.of.some.type"), "all expressions of some type",
                                "'_Expression:[exprtype( SomeType )]",
                                getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.sample.method.invokation.with.constant.argument"),
                                "sample method invocation with constant argument",
                                "Integer.parseInt('_a:[script( \"com.intellij.psi.util.PsiUtil.isConstantExpression(__context__)\" )])",
                                getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.method.references"), "method references",
                                "'_Qualifier::'Method",
                                getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.string.concatenations"),
                                "string concatenations with many operands",
                                "[exprtype( java\\.lang\\.String )]'_a + '_b{10,}",
                                getExpressionType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.deprecated.method.calls"), "method calls to deprecated methods",
                                "'_Instance?.'MethodCall:[ref( deprecated methods )]('_Parameter*)",
                                getExpressionType(), JavaFileType.INSTANCE),
      createConfiguration(SSRBundle.message("predefined.configuration.pattern.matching.instanceof"), "Pattern matching instanceof",
                          "$operand$ instanceof $Type$ $var$",
                          getExpressionType(), JavaFileType.INSTANCE),

      // Operators
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.block.dcls"), "block dcls",
                                "{\n  '_Type 'Var+ = '_Init?;\n  '_BlockStatements*;\n}",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.trys"), "try's",
                                "try {\n  '_TryStatement+;\n} catch('_ExceptionType '_Exception) {\n  '_CatchStatement*;\n}",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.ifs"), "if's",
                                "if ('_Condition) {\n  '_ThenStatement*;\n} else {\n  '_ElseStatement*;\n}",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.switches"), "switches",
                                "switch('_Condition) {\n  '_Statement*;\n}",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.foreaches"), "foreach loops",
                                "for ('_Type '_Variable : '_Expression) {\n  '_Statement*;\n}",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.logging.without.if"), "logging without if",
                                "[!within( statement in if )]LOG.debug('_Argument*);",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.statement.in.if"), "statement in if",
                                "if('_condition) { 'statement*; }",
                                getOperatorType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.assert.without.description"),
                                "assert statement without description",
                                "assert '_condition : '_description{0};",
                                getOperatorType(), JavaFileType.INSTANCE),

      // Class based
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.methods.of.the.class"), "constructors \\& methods",
                                "'_ReturnType? '_Method('_ParameterType '_Parameter*);",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.deprecated.methods"), "deprecated methods",
                                "@Deprecated\n'_ReturnType '_Method('_ParameterType '_Parameter*);",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.fields.of.the.class"), "fields of a class",
                                "class '_Class:[script( \"!__context__.interface && !__context__.enum && !__context__.record\" )] {\n" +
                                "  '_FieldType 'Field+ = '_Init?;\n" +
                                "}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.all.methods.of.the.class.within.hierarchy"),
                                "all methods of a class (within hierarchy)",
                                "class '_Class:[script( \"!__context__.interface && !__context__.enum && !__context__.record\" )] {\n" +
                                "  '_ReturnType 'Method+:* ('_ParameterType '_Parameter*);\n" +
                                "}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.all.fields.of.the.class"), "all fields of a class",
                                "class '_Class:[script( \"!__context__.interface && !__context__.enum && !__context__.record\" )] {\n" +
                                "  '_FieldType 'Field+:* = '_Init?;\n" +
                                "}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.instance.fields.of.the.class"), "instance fields of a class",
                                "class '_Class { \n  @Modifier(\"Instance\") '_FieldType 'Field+ = '_Init?;\n}",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.packagelocal.fields.of.the.class"), "package-private fields",
                                "@Modifier(\"packageLocal\") '_FieldType 'Field = '_Init?;",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.constructors.of.the.class"), "class constructors",
                                "'Class('_ParameterType '_Parameter*) {\n  '_Statement*;\n}",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.classes"), "classes",
                                "class 'Class:[script( \"!__context__.interface && !__context__.enum && !__context__.record\" )] {}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.classes.interfaces.enums"), "classes, interfaces \\& enums",
                                "class 'ClassInterfaceEnum {}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.direct.subclasses"), "direct subclasses",
                                "class 'Class extends '_Parent {}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.implementors.of.interface.within.hierarchy"),
                                "implementors of interface (within hierarchy)",
                                "class 'Class implements '_Interface:* {}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.interfaces"), "interfaces",
                                "interface 'Interface {}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.inner.classes"), "inner classes",
                                "class '_ {\n  class 'InnerClass+ {}\n}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.all.inner.classes.within.hierarchy"),
                                "all inner classes (within hierarchy)",
                                "class '_Class {\n  class 'InnerClass+:* {}\n}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.anonymous.classes"), "anonymous classes",
                                "new 'AnonymousClass() {}",
                                getClassType(), JavaFileType.INSTANCE),
      createConfiguration(SSRBundle.message("predefined.configuration.local.classes"), "Local classes",
                          "{\n" +
                          "  '_before*;\n" +
                          "  class 'Local {}\n" +
                          "  '_after*;\n" +
                          "}",
                          getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.class.implements.two.interfaces"),
                                "class implementing two interfaces",
                                "class 'A implements '_Interface1:[regex( *java\\.lang\\.Cloneable )], '_Interface2:*java\\.io\\.Serializable {\n}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.class.static.blocks"), "static initializers",
                                "static {\n  '_Statement*;\n}",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.class.instance.initialization.blocks"), "instance initializers",
                                "@Modifier(\"Instance\") {\n  '_Statement*;\n}",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.class.any.initialization.blocks"), "any initializer",
                                "{\n  '_Statement*;\n}",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.enums"), "enums",
                                "enum 'Enum {}",
                                getClassType(), JavaFileType.INSTANCE),
      createConfiguration(SSRBundle.message("predefined.configuration.records"), "Records",
                          "record 'Record('_Type '_component*) {}",
                          getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.class.with.parameterless.constructors"),
                                "classes with parameterless constructors",
                                "class 'Class {\n  '_Method{0,0}('_ParameterType '_Parameter+);\n}",
                                getClassType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.static.fields.without.final"),
                                "static fields that are not final",
                                "static '_Type 'Variable+:[ script( \"!__context__.hasModifierProperty(\"final\")\" ) ] = '_Init?;",
                                getClassType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.interfaces.having.no.descendants"),
                                "interface that is not implemented or extended",
                                "interface 'A:[script( \"com.intellij.psi.search.searches.ClassInheritorsSearch.search(__context__).findFirst() == null\" )] {}",
                                getClassType(), JavaFileType.INSTANCE),

      // Generics
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.generic.classes"), "generic classes",
                                "class 'GenericClass<'_TypeParameter+> {} ",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.generic.methods"), "generic methods",
                                "<'_TypeParameter+> '_Type '_Method('_ParameterType '_Parameter*);",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.typed.symbol"), "typed symbol",
                                "'Symbol <'_GenericArgument+>",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.generic.casts"), "generic casts",
                                "( '_Type <'_GenericArgument+> ) '_Expr",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.type.var.substitutions.in.instanceof.with.generic.types"),
                                "type var substitutions in intanceof with generic types",
                                "'_Expr instanceof '_Type <'Substitutions+> ",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.variables.of.generic.types"), "variables of generic types",
                                "'_Type <'_GenericArgument+>  'Var = '_Init?;",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.diamond.operators"), "diamond operators",
                                "new 'Class<>('_Argument*)",
                                getGenericsType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.method.returns.bounded.wildcard"),
                                "method returns bounded wildcard",
                                "[script( \"!Method.hasModifierProperty(com.intellij.psi.PsiModifier.ABSTRACT)\" )]'_Type<? extends '_Bound> 'Method('_ParameterType '_Parameter*);",
                                getGenericsType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.generic.constructors"), "generic constructors",
                                "<'_TypeParameter+> 'Class('_ParameterType '_Parameter*) {\n  '_Statement*;\n}",
                                getGenericsType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),

      // Add comments and metadata
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.comments"), "comments",
                                "/* 'CommentContent */", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.javadoc.annotated.class"), "javadoc annotated class",
                                "/**\n" +
                                " * '_Comment\n" +
                                " * @'_Tag* '_TagValue*\n" +
                                " */\n" +
                                "class '_Class {\n" +
                                "}", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.javadoc.annotated.methods"),
                                "javadoc annotated methods \\& constructors",
                                "/**\n" +
                                " * '_Comment\n" +
                                " * @'_Tag* '_TagValue*\n" +
                                " */\n" +
                                "'_Type? '_Method('_ParameterType '_Parameter*);",
                                getMetadataType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.javadoc.annotated.fields"), "javadoc annotated fields",
                                "/**\n" +
                                " * '_Comment\n" +
                                " * @'_Tag* '_TagValue*\n" +
                                " */\n" +
                                "'_Type+ 'Field+ = '_Init*;",
                                getMetadataType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.javadoc.tags"), "javadoc tags",
                                "/** @'Tag+ '_TagValue* */", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.xdoclet.metadata"), "XDoclet metadata",
                                "/** @'Tag \n  '_Property+\n*/",
                                getMetadataType(), JavaFileType.INSTANCE),

      createLegacyConfiguration(SSRBundle.message("predefined.configuration.annotations"), "annotations",
                                "@'_Annotation", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.annotated.class"), "annotated classes",
                                "@'_Annotation\n" +
                                "class 'Class {}", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.annotated.fields"), "annotated fields",
                                "@'_Annotation+\n" +
                                "'_FieldType 'Field+ = '_Init?;\n",
                                getMetadataType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.annotated.methods"), "annotated methods",
                                "@'_Annotation+\n'_MethodType '_Method('_ParameterType '_Parameter*);",
                                getMetadataType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),

      createLegacyConfiguration(SSRBundle.message("predefined.configuration.not.annotated.methods"), "not annotated methods",
                                "@'_Annotation{0,0}\n'_MethodType '_Method('_ParameterType '_Parameter*);",
                                getMetadataType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),

      createLegacyConfiguration(SSRBundle.message("predefined.configuration.annotation.declarations"), "annotation declarations",
                                "@interface 'Interface {}", getMetadataType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.comments.containing.word"), "comments containing a given word",
                                "// '_before bug '_after",
                                getMetadataType(), JavaFileType.INSTANCE),

      // J2EE templates
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.struts.1.1.actions"), "Struts 1.1 actions",
                                            "public class '_StrutsActionClass extends '_ParentClass*:Action {\n" +
                                            "  public ActionForward '_AnActionMethod:*execute (ActionMapping '_action,\n" +
                                            "                                 ActionForm '_form,\n" +
                                            "                                 HttpServletRequest '_request,\n" +
                                            "                                 HttpServletResponse '_response);\n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.entity.ejb"), "entity ejb",
                                            "class 'EntityBean implements EntityBean {\n" +
                                            "  EntityContext '_Context?;\n\n" +
                                            "  public void setEntityContext(EntityContext '_Context2);\n\n" +
                                            "  public '_RetType ejbCreate('_CreateType '_CreateDcl*);\n" +
                                            "  public void ejbActivate();\n\n" +
                                            "  public void ejbLoad();\n\n" +
                                            "  public void ejbPassivate();\n\n" +
                                            "  public void ejbRemove();\n\n" +
                                            "  public void ejbStore();\n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.session.ejb"), "session ejb",
                                            "class 'SessionBean implements SessionBean {\n" +
                                            "  SessionContext '_Context?;\n\n" +
                                            "  public void '_setSessionContext(SessionContext '_Context2);\n\n" +
                                            "  public '_RetType ejbCreate('_CreateParameterType '_CreateParameterDcl*);\n" +
                                            "  public void ejbActivate();\n\n" +
                                            "  public void ejbPassivate();\n\n" +
                                            "  public void ejbRemove();\n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.ejb.interface"), "ejb interface",
                                            "interface 'EjbInterface extends EJBObject {\n" +
                                            "  '_Type '_Method+('_ParameterType '_Param*);\n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.servlets"), "servlets",
                                            "public class 'Servlet extends '_ParentClass:*HttpServlet {\n" +
                                            "  public void '_InitServletMethod?:init ();\n" +
                                            "  public void '_DestroyServletMethod?:destroy ();\n" +
                                            "  void '_ServiceMethod?:*service (HttpServletRequest '_request, HttpServletResponse '_response);\n" +
                                            "  void '_SpecificServiceMethod*:do.* (HttpServletRequest '_request2, HttpServletResponse '_response2); \n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.filters"), "filters",
                                            "public class 'Filter implements Filter {\n" +
                                            "  public void '_DestroyFilterMethod?:*destroy ();\n" +
                                            "  public void '_InitFilterMethod?:*init ();\n" +
                                            "  public void '_FilteringMethod:*doFilter (ServletRequest '_request,\n" +
                                            "    ServletResponse '_response,FilterChain '_chain);\n" +
                                            "}", getJ2EEType(), JavaFileType.INSTANCE, null),

      // Misc types
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.serializable.classes.and.their.serialization.implementation"),
                                "Serializable classes and their serialization implementation",
                                "class 'Class implements '_Serializable:*Serializable {\n" +
                                "  static final long '_VersionField?:serialVersionUID = '_VersionFieldInit?;\n" +
                                "  private static final ObjectStreamField[] '_persistentFields?:serialPersistentFields = '_persistentFieldInitial?; \n" +
                                "  private void '_SerializationWriteHandler?:writeObject (ObjectOutputStream '_stream) throws IOException;\n" +
                                "  private void '_SerializationReadHandler?:readObject (ObjectInputStream '_stream2) throws IOException, ClassNotFoundException;\n" +
                                "  Object '_SpecialSerializationReadHandler?:readResolve () throws ObjectStreamException;\n" +
                                "  Object '_SpecialSerializationWriteHandler?:writeReplace () throws ObjectStreamException;\n" +
                                "}", getMiscType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.cloneable.implementations"), "Cloneable implementations",
                                "class '_Class implements '_Interface:*Cloneable {\n" +
                                "  Object 'CloningMethod:*clone ();\n" +
                                "}", getMiscType(), JavaFileType.INSTANCE),
      createLegacyNonRecursiveConfiguration(SSRBundle.message("predefined.configuration.junit.test.cases"), "junit test cases",
                                            "public class 'TestCase extends '_TestCaseClazz:*TestCase {\n" +
                                            "  public void '_testMethod+:test.* ();\n" +
                                            "}", getMiscType(), JavaFileType.INSTANCE, null),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.singletons"), "singletons",
                                "class 'Class {\n" +
                                "  private 'Class('_ParameterType '_Parameter*) {\n" +
                                "   '_ConstructorStatement*;\n" +
                                "  }\n" +
                                "  private static '_Class '_Instance;\n" +
                                "  static '_Class '_GetInstance() {\n" +
                                "    '_SomeStatement*;\n" +
                                "    return '_Instance;\n" +
                                "  }\n" +
                                "}", getMiscType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.similar.methods.structure"), "similar methods structure",
                                "'_RetType '_Method('_ParameterType '_Parameter*) throws 'ExceptionType {\n" +
                                "  try {\n" +
                                "    '_OtherStatements+;\n" +
                                "  } catch('_SomeException '_Exception) {\n" +
                                "    '_CatchStatement*;\n" +
                                "    throw new 'ExceptionType('_ExceptionConstructorArgs*);\n" +
                                "  }\n" +
                                "}", getMiscType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.bean.info.classes"), "Bean info classes",
                                "class 'A implements '_:*java\\.beans\\.BeanInfo {\n" +
                                "}", getMiscType(), JavaFileType.INSTANCE),

      // interesting types
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.symbol"), "symbol",
                                "'Symbol", getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.fields.variables.read"), "fields/variables read",
                                "'Symbol:[ script( \"import com.intellij.psi.*\n" +
                                "import static com.intellij.psi.util.PsiUtil.*\n" +
                                "Symbol instanceof PsiReferenceExpression && isAccessedForReading(Symbol)\" ) ]",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.fields_variables.with.given.name.pattern.updated"),
                                "fields/variables with given name pattern updated",
                                "'Symbol:[regex( name ) && script( \"import com.intellij.psi.*\n" +
                                "import static com.intellij.psi.util.PsiUtil.*\n" +
                                "Symbol instanceof PsiExpression && isAccessedForWriting(Symbol) ||\n" +
                                "  Symbol instanceof PsiVariable && Symbol.getInitializer() != null\" )]", getInterestingType(),
                                JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.usage.of.derived.type.in.cast"),
                                "usage of derived type in cast",
                                "('CastType:*[regex( Base )]) '_Expr",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.boxing.in.declarations"), "boxing in declarations",
                                "'_Type:Object|Integer|Boolean|Long|Character|Short|Byte 'Var = '_Value:[exprtype( int|boolean|long|char|short|byte )];",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.unboxing.in.declarations"), "unboxing in declarations",
                                "'_Type:int|boolean|long|char|short|byte 'Var = '_Value:[exprtype( Integer|Boolean|Long|Character|Short|Byte )];",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.boxing.in.method.calls"), "boxing in method calls",
                                "'_Instance?.'Call('_BeforeParam*,'_Param:[ exprtype( int|boolean|long|char|short|byte ) && formal( Object|Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.unboxing.in.method.calls"), "unboxing in method calls",
                                "'_Instance?.'Call('_BeforeParam*,'_Param:[ formal( int|boolean|long|char|short|byte ) && exprtype( Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.any.boxing"), "boxed expressions",
                                "'_expression:[ exprtype( int|boolean|long|char|short|byte ) && formal( Object|Integer|Boolean|Long|Character|Short|Byte )]",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.any.unboxing"), "unboxed expressions",
                                "'_expression:[ formal( int|boolean|long|char|short|byte ) && exprtype( Integer|Boolean|Long|Character|Short|Byte )]",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.try.without.resources"),
                                "try statements without resources and catch blocks",
                                "try ('_ResourceType '_resource{0,0} = '_init; '_expression{0,0}) {\n  '_TryStatement*;\n} catch('_ExceptionType '_Exception{0,0}) {\n  '_CatchStatement*;\n}",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.switch.with.branches"),
                                "switch statements \\& expressions with few branches",
                                "[ script( \"import com.intellij.psi.*;\n" +
                                "import com.intellij.psi.util.*;\n" +
                                "PsiTreeUtil.getChildrenOfType(__context__.body, PsiSwitchLabelStatementBase.class).length < 5\" ) ]switch ('_expression) {\n}",
                                getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.labeled.break"), "labeled break statements",
                                "break '_label;", getInterestingType(), JavaFileType.INSTANCE),
      createLegacyConfiguration(SSRBundle.message("predefined.configuration.methods.with.final.parameters"),
                                "methods \\& constructors with final parameters",
                                "'_ReturnType? '_Method('_BeforeType '_BeforeParameter*, final '_ParameterType '_Parameter, '_AfterType '_AfterParameter*);",
                                getInterestingType(), JavaFileType.INSTANCE, JavaStructuralSearchProfile.MEMBER_CONTEXT),
      createConfiguration(SSRBundle.message("predefined.configuration.double.checked.locking"), "double-checked locking",
                          "if ('_condition) {\n" +
                          "  synchronized ('_lock) {\n" +
                          "    if ('_condition) {\n" +
                          "      '_statement+;\n" +
                          "    }\n" +
                          "  }\n" +
                          "}",
                          getInterestingType(), JavaFileType.INSTANCE),
      //createSearchTemplateInfo("methods called","'_?.'_:[ref('Method)] ('_*)", INTERESTING_TYPE),
      //createSearchTemplateInfo("fields selected","'_?.'_:[ref('Field)] ", INTERESTING_TYPE),
      //createSearchTemplateInfo("symbols used","'_:[ref('Symbol)] ", INTERESTING_TYPE),
      //createSearchTemplateInfo("types used","'_:[ref('Type)] '_;", INTERESTING_TYPE),
    };
  }

  private static String getExpressionType() {
    return SSRBundle.message("expressions.category");
  }

  private static String getInterestingType() {
    return SSRBundle.message("interesting.category");
  }

  private static String getJ2EEType() {
    return SSRBundle.message("j2ee.category");
  }

  private static String getOperatorType() {
    return SSRBundle.message("operators.category");
  }

  private static String getClassType() {
    return SSRBundle.message("class.category");
  }

  private static String getMetadataType() {
    return SSRBundle.message("metadata.category");
  }

  private static String getMiscType() {
    return SSRBundle.message("misc.category");
  }

  private static String getGenericsType() {
    return SSRBundle.message("generics.category");
  }
}


text:
namespace uilib
{
AutoFitWidget::AutoFitWidget(CCNode *node)
{
    m_node = node;
    this->CCNode::addChild(node);
}
AutoFitWidget::~AutoFitWidget()
{
    if(m_node)
        m_node->removeFromParentAndCleanup(true);
}
void AutoFitWidget::layoutCompleted()
{
    BasWidget::layoutCompleted();
    CCSize size = m_node->getContentSize();
    m_node->setScaleX(m_anchorWidth / size.width);
    m_node->setScaleY(m_anchorHeight / size.height);
    m_node->setAnchorPoint(ccp(0.5,0.5));
    m_node->setPosition(ccp(m_anchorWidth / 2,m_anchorHeight / 2));
}
}


text:
package controllers

import (
	"math/rand"
	"sort"

	"github.com/coocood/qbs"
	"github.com/revel/revel"
)

func (c App) QbsDb(queries int) revel.Result {
	qbs, _ := qbs.GetQbs()
	defer qbs.Close()

	if queries <= 1 {
		var w World
		w.Id = uint16(rand.Intn(WorldRowCount) + 1)
		err := qbs.Find(&w)
		if err != nil {
			revel.ERROR.Fatalf("Error scanning world row: %v", err)
		}
		return c.RenderJson(w)
	}

	ww := make([]World, queries)
	for i := 0; i < queries; i++ {
		ww[i].Id = uint16(rand.Intn(WorldRowCount) + 1)
		if err := qbs.Find(&ww[i]); err != nil {
			revel.ERROR.Fatalf("Error scanning world row: %v", err)
		}
	}
	return c.RenderJson(ww)
}

func (c App) QbsUpdate(queries int) revel.Result {
	qbs, _ := qbs.GetQbs()
	defer qbs.Close()

	if queries <= 1 {
		var w World
		w.Id = uint16(rand.Intn(WorldRowCount) + 1)
		if err := qbs.Find(&w); err != nil {
			revel.ERROR.Fatalf("Error scanning world row: %v", err)
		}
		w.RandomNumber = uint16(rand.Intn(WorldRowCount) + 1)
		if _, err := qbs.Save(&w); err != nil {
			revel.ERROR.Fatalf("Error updating world row: %v", err)
		}
		return c.RenderJson(&w)
	}

	ww := make([]World, queries)
	for i := 0; i < queries; i++ {
		ww[i].Id = uint16(rand.Intn(WorldRowCount) + 1)
		if err := qbs.Find(&ww[i]); err != nil {
			revel.ERROR.Fatalf("Error scanning world row: %v", err)
		}
		ww[i].RandomNumber = uint16(rand.Intn(WorldRowCount) + 1)
		if _, err := qbs.Save(&ww[i]); err != nil {
			revel.ERROR.Fatalf("Error scanning world row: %v", err)
		}
	}
	return c.RenderJson(ww)
}

func (c App) QbsFortune() revel.Result {
	qbs, _ := qbs.GetQbs()
	defer qbs.Close()

	var fortunes []*Fortune
	qbs.FindAll(&fortunes)
	fortunes = append(fortunes,
		&Fortune{Message: "Additional fortune added at request time."})
	sort.Sort(ByMessage{fortunes})
	c.RenderArgs["fortunes"] = fortunes
	return c.RenderTemplate("App/Fortune.html")
}


text:
package org.onesocialweb.gwt.client.i18n;

import com.google.gwt.i18n.client.Messages;

public interface CustomValidationMessagesImpl extends Messages {

	public String length(int minLength, int maxLength);

}


text:
namespace Envoy {
namespace Server {
namespace Configuration {
MockBootstrapExtensionFactory::MockBootstrapExtensionFactory() = default;

MockBootstrapExtensionFactory::~MockBootstrapExtensionFactory() = default;

} // namespace Configuration
} // namespace Server
} // namespace Envoy


text:
int main(int argc, char *argv[]) {
  try {
    using namespace kaldi;
    typedef kaldi::int32 int32;
    using fst::SymbolTable;
    using fst::VectorFst;
    using fst::StdArc;

    const char *usage =
        "Align features given [SGMM-based] models.\n"
        "Usage: sgmm-align-compiled [options] model-in graphs-rspecifier "
        "feature-rspecifier alignments-wspecifier\n"
        "e.g.: sgmm-align-compiled 1.mdl ark:graphs.fsts scp:train.scp ark:1.ali\n";

    ParseOptions po(usage);
    bool binary = true;
    AlignConfig align_config;
    BaseFloat acoustic_scale = 1.0;
    BaseFloat transition_scale = 1.0;
    BaseFloat self_loop_scale = 1.0;
    BaseFloat log_prune = 5.0;

    std::string gselect_rspecifier, spkvecs_rspecifier, utt2spk_rspecifier;
    SgmmGselectConfig sgmm_opts;

    align_config.Register(&po);
    po.Register("binary", &binary, "Write output in binary mode");
    po.Register("log-prune", &log_prune, "Pruning beam used to reduce number "
                "of exp() evaluations.");
    po.Register("spk-vecs", &spkvecs_rspecifier, "Speaker vectors (rspecifier)");
    po.Register("utt2spk", &utt2spk_rspecifier,
                "rspecifier for utterance to speaker map");
    po.Register("acoustic-scale", &acoustic_scale, "Scaling factor for acoustic "
                "likelihoods");
    po.Register("transition-scale", &transition_scale, "Scaling factor for "
                "some transition probabilities [see also self-loop-scale].");
    po.Register("self-loop-scale", &self_loop_scale, "Scaling factor for "
                "self-loop versus non-self-loop probability mass [controls "
                "most transition probabilities.]");
    po.Register("gselect", &gselect_rspecifier, "Precomputed Gaussian indices "
                "(rspecifier)");
    sgmm_opts.Register(&po);

    po.Read(argc, argv);

    if (po.NumArgs() != 4) {
      po.PrintUsage();
      exit(1);
    }

    std::string model_in_filename = po.GetArg(1),
        fst_rspecifier = po.GetArg(2),
        feature_rspecifier = po.GetArg(3),
        alignment_wspecifier = po.GetArg(4);

    TransitionModel trans_model;
    AmSgmm am_sgmm;
    {
      bool binary;
      Input ki(model_in_filename, &binary);
      trans_model.Read(ki.Stream(), binary);
      am_sgmm.Read(ki.Stream(), binary);
    }

    SequentialTableReader<fst::VectorFstHolder> fst_reader(fst_rspecifier);
    RandomAccessBaseFloatMatrixReader feature_reader(feature_rspecifier);
    RandomAccessInt32VectorVectorReader gselect_reader(gselect_rspecifier);

    RandomAccessBaseFloatVectorReaderMapped spkvecs_reader(spkvecs_rspecifier,
                                                           utt2spk_rspecifier);

    Int32VectorWriter alignment_writer(alignment_wspecifier);

    int32 num_done = 0, num_err = 0, num_retry = 0;
    double tot_like = 0.0;
    kaldi::int64 frame_count = 0;

    for (; !fst_reader.Done(); fst_reader.Next()) {
      std::string utt = fst_reader.Key();
      if (!feature_reader.HasKey(utt)) {
        KALDI_WARN << "No features found for utterance " << utt;
        num_err++;
        continue;
      }
      VectorFst<StdArc> decode_fst(fst_reader.Value());
      // stops copy-on-write of the fst by deleting the fst inside the reader,
      // since we're about to mutate the fst by adding transition probs.
      fst_reader.FreeCurrent();

      const Matrix<BaseFloat> &features = feature_reader.Value(utt);
      if (features.NumRows() == 0) {
        KALDI_WARN << "Empty features for utterance " << utt;
        num_err++;
        continue;
      }

      SgmmPerSpkDerivedVars spk_vars;
      if (spkvecs_reader.IsOpen()) {
        if (spkvecs_reader.HasKey(utt)) {
          spk_vars.v_s = spkvecs_reader.Value(utt);
          am_sgmm.ComputePerSpkDerivedVars(&spk_vars);
        } else {
          KALDI_WARN << "Cannot find speaker vector for " << utt;
          num_err++;
          continue;
        }
      }  // else spk_vars is "empty"

      bool have_gselect  = !gselect_rspecifier.empty()
          && gselect_reader.HasKey(utt)
          && gselect_reader.Value(utt).size() == features.NumRows();
      if (!gselect_rspecifier.empty() && !have_gselect)
        KALDI_WARN << "No Gaussian-selection info available for utterance "
                   << utt << " (or wrong size)";
      std::vector<std::vector<int32> > empty_gselect;
      const std::vector<std::vector<int32> > *gselect =
          (have_gselect ? &gselect_reader.Value(utt) : &empty_gselect);

      {  // Add transition-probs to the FST.
        std::vector<int32> disambig_syms;  // empty.
        AddTransitionProbs(trans_model, disambig_syms,
                           transition_scale, self_loop_scale,
                           &decode_fst);
      }

      DecodableAmSgmmScaled sgmm_decodable(sgmm_opts, am_sgmm, spk_vars, trans_model,
                                           features, *gselect, log_prune, acoustic_scale);

      AlignUtteranceWrapper(align_config, utt,
                            acoustic_scale, &decode_fst, &sgmm_decodable,
                            &alignment_writer, NULL,
                            &num_done, &num_err, &num_retry,
                            &tot_like, &frame_count);
    }

    KALDI_LOG << "Overall log-likelihood per frame is " << (tot_like/frame_count)
              << " over " << frame_count<< " frames.";
    KALDI_LOG << "Retried " << num_retry << " out of "
              << (num_done + num_err) << " utterances.";
    KALDI_LOG << "Done " << num_done << ", errors on " << num_err;
    return (num_done != 0 ? 0 : 1);
  } catch(const std::exception &e) {
    std::cerr << e.what();
    return -1;
  }
}