text:
package annis.ql.parser;

/**
 * Transformer or optimizer for {@link QueryData}.
 * @author Thomas Krause <thomas.krause@alumni.hu-berlin.de>
 */
public interface QueryDataTransformer
{
  /**
   * Transforms or optimizes a specific {@link QueryData}.
   * The resulting opject might be a clone of the original one.
   * @param data The data to transform.
   * @return  The (possably new object) with the transformation applied.
   */
  public QueryData transform(QueryData data);
}


text:
Phower Config
=============

Simplified methods to handle configuration data in PHP.

Requirements
------------

Phower Config requires:

-   [PHP 5.6](http://php.net/releases/5_6_0.php) or above;
    version [7.0](http://php.net/releases/7_0_0.php) is recommended

Instalation
-----------

Add Phower Config to any PHP project using [Composer](https://getcomposer.org/):

```bash
composer require phower/config
```

Getting Started
---------------

An associative array can be used as configuration data to be handled on
any application.

```php
// index.php
require('path/to/vendor/autoload.php');

use Phower\Config\Config;

// array of options
$options = [
    'host' => 'example.org',
    'email' => 'me@example.org',
    'user_name' => 'Pedro',
    'password' => 'Secre7!#@',
];

// create config instance
$config = new Config($options);

// access a configuration key
echo $config->get('email'); // 'me@example.org'
```

### Include configuration

Optionally configuration data can be read from a plain PHP script
returning an array:

```php
// config.php
return [
    'host' => 'example.org',
    'email' => 'me@example.org',
    'password' => 'Secre7!#@',
];

// index.php
$config = new Config(include('config.php'));
```

### Interface methods

Because we implemented [ArrayAccess Interface](http://php.net/manual/en/class.arrayaccess.php)
and [Magic Methods](http://php.net/manual/en/language.oop5.magic.php) it's also possible
to access configuration data in different styles:

```php
// equivalent methods
echo $config->get('email'); // 'me@example.org'
echo $config['email'];      // 'me@example.org'
echo $config->email;        // 'me@example.org'
echo $config->getEmail();   // 'me@example.org'
```

### Normalized key names

Since key names are normalized internally it's possible to relax on naming
conventions:

```php
// always refer same key
echo $config->get('user_name'); // 'Pedro'
echo $config->get('userName');  // 'Pedro'
echo $config->get('USER-NAME'); // 'Pedro'
echo $config->get('username');  // 'Pedro'

// same applies when using different methods of example above
```

> Note that normalized key names can ride to duplicates which should be avoided by
> using some sort of naming convention when Phower Config instances are created. E.g
> always use snake-case or camel case on array element keys.

### Read-only mode

By default instances are created read-only which means they can't be changed after creation.
However this behaviour can be changed in two ways:

```php
// 1. create instance with read-only mode set to false
$config = new Config(include('config.php'), false);
echo $config->readOnly(); // FALSE

// 2. optionally set read-only mode after creation
$config = new Config(include('config.php'));
echo $config->readOnly(); // TRUE

$config->readOnly(false);
echo $config->readOnly(); // FALSE
```

> Note the argument of `readOnly` method is optional. When omitted the method
> returns the state of read-only mode; otherwise it sets its state to TRUE or FALSE.

### Allow-override mode

Like in read-only mode it's also possible to control overrides in Phower Config instances.
Initially overrides are not allowed but this can be changed like previously:

```php
// 1. create instance with allow-override mode set to true
$config = new Config(include('config.php'), false, true);
echo $config->allowOverride(); // TRUE

// 2. optionally set allow-override mode after creation
$config = new Config(include('config.php'));
echo $config->allowOverride(); // FALSE

$config->allowOverride(true);
echo $config->allowOverride(); // TRUE
```

> Note the argument of `allowOverride` method is optional. When omitted the method
> returns the state of allow-override mode; otherwise it sets its state to TRUE or FALSE.

> Obviously overrides can only be done with read-only mode set to FALSE.

### Changing configuration

When required to change configuration after creation that can be done by setting or
removing keys:

```php
// create empty config instance with read-only set to FALSE
$config = new Config([], false);

// set some keys
$config->set('host', 'example.org')
       ->set('email', 'me@example.org')
       ->set('user_name', 'Pedro')
       ->set('password', 'Secre7!#@');

// remove one key
$config->remove('user_name');
```

Like in getting key values from configuration array access interface and magic methods are
also available:

```php
// setting keys
$config['host'] = 'example.org';
$config->host = 'example.org';
$config->setHost('example.org');

// removing keys
unset($config['host']);
unset($config->host);
$config->removeHost();
```

### Checking configuration

To check if a given key exists in configuration another method is available:

```php
// checking 'host' key
echo $config->has('host'); // returns TRUE if exists otherwise FALSE

// alternative interfaces
isset($config['host']);
isset($config->host);
$config->hasHost();
```

Advanced Usage
--------------

In some situations may be required to export a configuration instance to array or merge
another config object into the current instance. To provide these needs methods `toArray`
and `merge` are available:

```php
// exporting configuration
$config = new Config($options);
$config->toArray(); // returns $options array

// merging configurations
$config1 = new Config($someOptions);
$config2 = new Config($otherOptions);

$config1->merge($config2); // $otherOptions are merged with $someOptions internally
```

Running Tests
-------------

Tests are available in a separated namespace and can run with [PHPUnit](http://phpunit.de/)
in the command line:

```bash
vendor/bin/phpunit
```

Coding Standards
----------------

Phower code is written under [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style standard.
To enforce that [CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) tools are also
provided and can run as:

```bash
vendor/bin/phpcs
```

Reporting Issues
----------------

In case you find issues with this code please open a ticket in Github Issues at
[https://github.com/phower/config/issues](https://github.com/phower/config/issues).

Contributors
------------

Open Source is made of contribuition. If you want to contribute to Phower please
follow these steps:

1.  Fork latest version into your own repository.
2.  Write your changes or additions and commit them.
3.  Follow PSR-2 coding style standard.
4.  Make sure you have unit tests with full coverage to your changes.
5.  Go to Github Pull Requests at [https://github.com/phower/config/pulls](https://github.com/phower/config/pulls)
    and create a new request.

Thank you!

Changes and Versioning
----------------------

All relevant changes on this code are logged in a separated [log](CHANGELOG.md) file.

Version numbers follow recommendations from [Semantic Versioning](http://semver.org/).

License
-------

Phower code is maintained under [The MIT License](https://opensource.org/licenses/MIT).

redpajama_set_name: RedPajamaGithub


text:
package org.osanchezhuerta.employees.hr.ws.web.facade;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for insertarDepartmentInput complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="insertarDepartmentInput">
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="deptNo" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *         <element name="deptName" type="{http://www.w3.org/2001/XMLSchema}string"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "insertarDepartmentInput", propOrder = {
    "deptNo",
    "deptName"
})
public class InsertarDepartmentInput {

    @XmlElement(required = true)
    protected String deptNo;
    @XmlElement(required = true)
    protected String deptName;

    /**
     * Gets the value of the deptNo property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDeptNo() {
        return deptNo;
    }

    /**
     * Sets the value of the deptNo property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDeptNo(String value) {
        this.deptNo = value;
    }

    /**
     * Gets the value of the deptName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDeptName() {
        return deptName;
    }

    /**
     * Sets the value of the deptName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDeptName(String value) {
        this.deptName = value;
    }

}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Reader.Feeds.Tests
{
    [TestClass]
    public class RssFeedParserTests
    {
        FeedParserFactory factory = new FeedParserFactory();

        [TestInitialize]
        public void Initialize()
        {
            factory = new FeedParserFactory();
        }

        private Feed GetFeed(string path)
        {
            using (var fs = File.OpenRead(path))
            {
                var parser = factory.CreateParser(fs);
                return parser.ParseFeedInformation();
            }
        }

        private IEnumerable
 GetArticles(string path)
        {
            using (var fs = File.OpenRead(path))
            {
                var parser = factory.CreateParser(fs);
                return parser.ParseArticles();
            }
        }

        [TestMethod]
        public void TestFeedTitle()
        {
            var feed = GetFeed(@".\Data\Rss\PlanetPostgres.xml");
            Assert.AreEqual("Planet PostgreSQL", feed.Title);
        }

        [TestMethod]
        public void TestFeedDescription()
        {
            var feed = GetFeed(@".\Data\Rss\PlanetPostgres.xml");
            Assert.AreEqual("Planet PostgreSQL", feed.Subtitle);
        }

        [TestMethod]
        public void TestFeedEmptyDescription()
        {
            var feed = GetFeed(@".\Data\Rss\KalenDelaney.xml");
            Assert.AreEqual("", feed.Subtitle);
        }

        [TestMethod]
        public void TestFeedLanguage()
        {
            var feed = GetFeed(@".\Data\Rss\KalenDelaney.xml");
            Assert.AreEqual("en", feed.Language);
        }

        [TestMethod]
        public void TestFeedNullLanguage()
        {
            var feed = GetFeed(@".\Data\Rss\PlanetPostgres.xml");
            Assert.AreEqual(null, feed.Language);
        }

        [TestMethod]
        public void TestFeedLink()
        {
            var feed = GetFeed(@".\Data\Rss\PlanetPostgres.xml");
            Assert.AreEqual("http://planet.postgresql.org", feed.Link);
        }

        [TestMethod]
        public void TestFeedLastUpdate()
        {
            var feed = GetFeed(@".\Data\Rss\PlanetPostgres.xml");
            Assert.AreEqual(DateTime.Parse("14/11/2014 23:02:31"), feed.LastUpdate);
        }

        [TestMethod]
        public void TestFeedNullLastUpdate()
        {
            var feed = GetFeed(@".\Data\Rss\KalenDelaney.xml");
            Assert.AreEqual(DateTime.MinValue, feed.LastUpdate);
        }

        [TestMethod]
        public void TestArticleTitle()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual("Did You Know? My PASS Demo Scripts are Up (and other news)!", article.Title);
        }

        [TestMethod]
        public void TestArticleGuid()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual("21093a07-8b3d-42db-8cbf-3350fcbf5496:56387", article.Guid);
        }

        [TestMethod]
        public void TestArticleLink()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual("http://www2.sqlblog.com/blogs/kalen_delaney/archive/2014/11/10/my-pass-demo-scripts-are-up-and-other-news.aspx", article.Link);
        }

        [TestMethod]
        public void TestArticlePublicationDate()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual(DateTime.Parse("10/11/2014 22:48:00"), article.PublicationDate);
        }

        [TestMethod]
        public void TestArticleDescription()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual(@"And so another PASS Summit passes into history. It was an awesome week, filled with old friends and new, and lots of superlative technical content! My Hekaton book was released just in time, and it was great seeing the excitement. Red Gate gave away all...(read more)", article.Description);
        }

        [TestMethod]
        public void TestArticleAuthors()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();
            var author = article.Authors.First();

            Assert.AreEqual(@"Kalen Delaney", author.Name);
        }

        [TestMethod]
        public void TestArticleNullAuthors()
        {
            var articles = GetArticles(@".\Data\Rss\PlanetPostgres.xml");
            var article = articles.First();
            var author = article.Authors.FirstOrDefault();

            Assert.IsNull(author);
        }

        [TestMethod]
        public void TestArticleCategories()
        {
            var articles = GetArticles(@".\Data\Rss\KalenDelaney.xml");
            var article = articles.First();

            Assert.AreEqual(4, article.Categories.Count);
            Assert.IsTrue(article.Categories.Any(x => x.Name == "books"));
            Assert.IsTrue(article.Categories.Any(x => x.Name == "conference"));
            Assert.IsTrue(article.Categories.Any(x => x.Name == "Hekaton"));
            Assert.IsTrue(article.Categories.Any(x => x.Name == "raffle"));
        }

        [TestMethod]
        public void TestArticleNullCategories()
        {
            var articles = GetArticles(@".\Data\Rss\PlanetPostgres.xml");
            var article = articles.First();

            Assert.AreEqual(0, article.Categories.Count);
        }
    }
}


text:
package com.appsot.zqt.ip;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.StringTokenizer;

import android.content.Context;
import android.content.res.AssetManager;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.util.Log;

/**
 *
 * @author vFISHv
 * @email vfishv@gmail.com
 *
 */
public class Util {

	private static final String TAG = Util.class.getSimpleName();
	private static StringBuilder sb = new StringBuilder();
	/**
     * 从ip的字符串形式得到字节数组形式
     * @param ip 字符串形式的ip
     * @return 字节数组形式的ip
     */
    public static byte[] getIpByteArrayFromString(String ip) {
        byte[] ret = new byte[4];
        StringTokenizer st = new StringTokenizer(ip, ".");
        try {
            ret[0] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
            ret[1] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
            ret[2] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
            ret[3] = (byte)(Integer.parseInt(st.nextToken()) & 0xFF);
        } catch (Exception e) {
          //LogFactory.log("从ip的字符串形式得到字节数组形式报错", Level.ERROR, e);
          System.out.println("从ip的字符串形式得到字节数组形式报错");
        }
        return ret;
    }
    /**
     * @param ip ip的字节数组形式
     * @return 字符串形式的ip
     */
    public static String getIpStringFromBytes(byte[] ip) {
	    sb.delete(0, sb.length());
    	sb.append(ip[0] & 0xFF);
    	sb.append('.');
    	sb.append(ip[1] & 0xFF);
    	sb.append('.');
    	sb.append(ip[2] & 0xFF);
    	sb.append('.');
    	sb.append(ip[3] & 0xFF);
    	return sb.toString();
    }

    /**
     * 根据某种编码方式将字节数组转换成字符串
     * @param b 字节数组
     * @param offset 要转换的起始位置
     * @param len 要转换的长度
     * @param encoding 编码方式
     * @return 如果encoding不支持,返回一个缺省编码的字符串
     */
    public static String getString(byte[] b, int offset, int len, String encoding) {
        try {
            return new String(b, offset, len, encoding);
        } catch (UnsupportedEncodingException e) {
            return new String(b, offset, len);
        }
    }

    /**
     * 将 assets 中的大文件复制到其他地方
     * @param Ctxt
     * @param DBFile
     * @throws IOException
     */
    public static void CopyDatabase(Context Ctxt, File DBFile) throws IOException
    {
        AssetManager am = Ctxt.getAssets();
        OutputStream os = new FileOutputStream(DBFile);
        DBFile.createNewFile();
        byte []b = new byte[1024];
        int i, r;
        String []Files = am.list("");
        Arrays.sort(Files);
//        for(i=1;i<10;i++)
        {
            String fn = IPActivity.QQWryFileName;//String.format("%d.db", i);
//            if(Arrays.binarySearch(Files, fn) < 0)
//                   break;
            InputStream is = am.open(fn);
            while((r = is.read(b)) != -1)
                os.write(b, 0, r);
            is.close();
        }
        os.close();
    }

    public static String getLocalIpAddress() {
        try {
            for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
                NetworkInterface intf = en.nextElement();
                for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
                    InetAddress inetAddress = enumIpAddr.nextElement();
                    if (!inetAddress.isLoopbackAddress() && inetAddress instanceof Inet4Address) {
                        return inetAddress.getHostAddress();
                    }
                }
            }
        } catch (SocketException ex) {
            Log.e(TAG, "getLocalIpAddress. ", ex);
        }
        return "";
    }

	public String getLocalMacAddress(Context ctt)
	{
		WifiManager wifi = (WifiManager) ctt.getSystemService(Context.WIFI_SERVICE);
		WifiInfo info = wifi.getConnectionInfo();
		return info.getMacAddress();
	}

}


text:
#include "tensorflow/compiler/tf2tensorrt/utils/trt_engine_utils.h"

#include <string>
#include <vector>

#include "absl/strings/str_cat.h"
#include "tensorflow/compiler/tf2tensorrt/convert/utils.h"
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/framework/tensor_shape.h"
#include "tensorflow/core/lib/core/status.h"
#include "tensorflow/core/platform/errors.h"

#if GOOGLE_CUDA && GOOGLE_TENSORRT
#include "third_party/tensorrt/NvInfer.h"

namespace tensorflow {
namespace tensorrt {

using absl::StrCat;

Status GetTrtBindingShape(const nvinfer1::ICudaEngine* cuda_engine,
                          const nvinfer1::IExecutionContext* execution_context,
                          int binding_index, bool use_implicit_batch,
                          int batch_size, TensorShape& shape) {
  nvinfer1::Dims dims;
  if (use_implicit_batch) {
    dims = cuda_engine->getBindingDimensions(binding_index);
  } else {
#if IS_TRT_VERSION_GE(6, 0, 0, 0)
    // Get dims from context instead of engine in explicit batch mode because
    // the engine might have dynamic shapes.
    dims = execution_context->getBindingDimensions(binding_index);
    if (dims.nbDims == -1) {
      // Invalid dimensions. There can be multiple reasons for this. If we have
      // incompatible input shapes (network invalid for the current profile)
      // that can trigger this error.
      return errors::Internal(
          "Binding index out of range. This can happen if profile is not set, "
          "or the network is invalid for the current profile.");
    }
#else
    return errors::Internal(
        "Explicit batch mode is only supported with TensorRT 6 and above.");
#endif
  }
  TF_RETURN_IF_ERROR(
      TrtDimsToTensorShape(dims, use_implicit_batch, batch_size, shape));
  return Status::OK();
}

Status GetTrtBindingIndex(const char* tensor_name, int profile_index,
                          const nvinfer1::ICudaEngine* cuda_engine,
                          int* binding_index) {
  // If the engine has been built for K profiles, the first getNbBindings() / K
  // bindings are used by profile number 0, the following getNbBindings() / K
  // bindings are used by profile number 1 etc.
  //
  // GetBindingIndex(tensor_name) returns the binding index for the progile 0.
  // We can also consider it as a "binding_index_within_profile".
  *binding_index = cuda_engine->getBindingIndex(tensor_name);
  if (*binding_index == -1) {
    const string msg = StrCat("Input node ", tensor_name, " not found");
    LOG(ERROR) << msg;
    return errors::NotFound(msg);
  }
#if IS_TRT_VERSION_GE(6, 0, 0, 0)
  int n_profiles = cuda_engine->getNbOptimizationProfiles();
#else
  int n_profiles = 1;
#endif
  // If we have more then one optimization profile, then we need to shift the
  // binding index according to the following formula:
  // binding_index_within_engine = binding_index_within_profile +
  //                               profile_index * bindings_per_profile
  const int bindings_per_profile = cuda_engine->getNbBindings() / n_profiles;
  *binding_index = *binding_index + profile_index * bindings_per_profile;
  return Status::OK();
}

Status SetTrtEngineInputs(nvinfer1::ICudaEngine* cuda_engine,
                          nvinfer1::IExecutionContext* execution_context,
                          const int trt_profile_idx,
                          std::vector<void*>& buffers, bool use_implicit_batch,
                          int num_batch, OpKernelContext* ctx,
                          const DataVec* input_vec) {
  int n_inputs = ctx ? ctx->num_inputs() : (input_vec ? input_vec->size() : 0);
  // Setup engine inputs.
  for (int i = 0; i < n_inputs; i++) {
    const string input_name =
        ctx ? StrCat(IONamePrefixes::kInputPHName, i) : input_vec->at(i).name;
    int binding_index;
    TF_RETURN_IF_ERROR(GetTrtBindingIndex(input_name.c_str(), trt_profile_idx,
                                          cuda_engine, &binding_index));
    const Tensor& input_tensor = ctx ? ctx->input(i) : input_vec->at(i).tensor;
    const TensorShape& input_shape = input_tensor.shape();

    if (use_implicit_batch && ctx) {
      // Ensure all inputs have the same batch size
      if (num_batch != input_shape.dim_size(0)) {
        const string msg =
            StrCat("Input data has inconsistent batch size: ", num_batch,
                   " vs ", input_shape.dim_size(0));
        return errors::NotFound(msg);
      }
    }
#if IS_TRT_VERSION_GE(6, 0, 0, 0)
    // Set known input dimensions. This is necessary because TRT network
    // could be made with dynamic dimensions.
    if (!use_implicit_batch) {
      nvinfer1::Dims trt_dims;
      trt_dims.nbDims = input_shape.dims();
      for (int k = 0; k < input_shape.dims(); k++) {
        trt_dims.d[k] = input_shape.dim_size(k);
      }
      execution_context->setBindingDimensions(binding_index, trt_dims);
    }
#endif
    // Setup input bindings.
    auto dtype = cuda_engine->getBindingDataType(binding_index);
    switch (dtype) {
      case nvinfer1::DataType::kFLOAT:
        buffers[binding_index] =
            const_cast<float*>(input_tensor.flat<float>().data());
        break;
      case nvinfer1::DataType::kHALF:
        buffers[binding_index] =
            const_cast<Eigen::half*>(input_tensor.flat<Eigen::half>().data());
        break;
      case nvinfer1::DataType::kINT8:
        return errors::Internal("INT8 inputs are not supported yet!");
      case nvinfer1::DataType::kINT32:
        buffers[binding_index] =
            const_cast<int32*>(input_tensor.flat<int32>().data());
        break;
      default:
        return errors::Internal("Unknown TRT data type: ",
                                static_cast<int>(dtype));
    }
  }

#if IS_TRT_VERSION_GE(6, 0, 0, 0)
  // Ensure all network dynamic dimensions (if any) are set in execution
  // context.
  if (!execution_context->allInputDimensionsSpecified()) {
    return errors::Internal(
        "Failed to set dimensions for all dynamic input tensors");
  }
  if (!execution_context->allInputShapesSpecified()) {
    return errors::Internal(
        "Failed to set dimensions for all shape input tensors.");
  }
#endif
  return Status::OK();
}

Status SetTrtEngineOutputs(nvinfer1::ICudaEngine* cuda_engine,
                           nvinfer1::IExecutionContext* execution_context,
                           int trt_profile_idx, std::vector<void*>& buffers,
                           bool use_implicit_batch, int batch_size,
                           OpKernelContext* ctx, DataVec* outputs) {
  // Either one of ctx or outpus should be specified
  int n_outputs = ctx ? ctx->num_outputs() : (outputs ? outputs->size() : 0);
  for (int i = 0; i < n_outputs; i++) {
    const string output_name =
        ctx ? StrCat(IONamePrefixes::kOutputPHName, i) : outputs->at(i).name;
    int binding_index;
    TF_RETURN_IF_ERROR(GetTrtBindingIndex(output_name.c_str(), trt_profile_idx,
                                          cuda_engine, &binding_index));

    // Get TRT output shapes for allocating output memory.
    TensorShape output_shape;
    TF_RETURN_IF_ERROR(GetTrtBindingShape(cuda_engine, execution_context,
                                          binding_index, use_implicit_batch,
                                          batch_size, output_shape));

    // Allocate output tensor of TRTEngineOp.
    Tensor* output_tensor = nullptr;
    if (ctx) {
      TF_RETURN_IF_ERROR(ctx->allocate_output(i, output_shape, &output_tensor));
    } else {
      // This path is used for unit tests. The tensor is already allocated.
      // Its shape is not necessarily set correctly, we fix that.
      VLOG(2) << "Applying shape " << output_shape.DebugString()
              << " on output.";
      output_tensor = &(outputs->at(i).tensor);
      bool status = output_tensor->CopyFrom(*output_tensor, output_shape);
      if (!status) {
        return errors::Internal(
            "Buffer size do not match while reshaping output tensors");
      }
    }

    // Setup output bindings.
    auto dtype = cuda_engine->getBindingDataType(binding_index);
    switch (dtype) {
      case nvinfer1::DataType::kFLOAT:
        buffers[binding_index] =
            const_cast<float*>(output_tensor->flat<float>().data());
        break;
      case nvinfer1::DataType::kHALF:
        buffers[binding_index] =
            const_cast<Eigen::half*>(output_tensor->flat<Eigen::half>().data());
        break;
      case nvinfer1::DataType::kINT8:
        return errors::Internal("int8 is not supported yet!");
      case nvinfer1::DataType::kINT32:
        buffers[binding_index] =
            const_cast<int32*>(output_tensor->flat<int32>().data());
        break;
      default:
        return errors::Internal("Unknown TRT data type: ",
                                static_cast<int>(dtype));
    }
  }
  return Status::OK();
}

Status TrtEnqueue(nvinfer1::IExecutionContext* execution_context,
                  std::vector<void*>& buffers, cudaStream_t stream,
                  bool use_implicit_batch, int batch_size) {
  bool ret = false;
  if (use_implicit_batch) {
    ret = execution_context->enqueue(batch_size, &buffers[0], stream, nullptr);
    VLOG(1) << "Called IExecutionContext::enqueue";
  } else {
#if IS_TRT_VERSION_GE(6, 0, 0, 0)
    ret = execution_context->enqueueV2(&buffers[0], stream, nullptr);
    VLOG(1) << "Called IExecutionContext::enqueueV2";
#else
    return errors::Internal(
        "Explicit batch mode is only supported with TensorRT 6 and above.");
#endif
  }
  if (!ret) {
    return errors::Internal("Failed to enqueue batch for TRT engine");
  }
  // Synchronization will be done by TF.
  return Status::OK();
}

}  // namespace tensorrt
}  // namespace tensorflow

#endif  // GOOGLE_CUDA && GOOGLE_TENSORRT


text:
(function(w, log, pow, sqrt) {
	w.ForceDirectedLayout = function(config) {
		for (var prop in config) {
	        this[prop] = config[prop];
		}

		var that = this;

		this._onStep = function() {
			that.currentStep++;

			that.circles.forEach(function(v) {
				that.circles.forEach(function(u) {
					if (u != v) {
						var dx = v.getX() - u.getX();
						var dy = v.getY() - u.getY();
						var d2 = pow(dx, 2) + pow(dy, 2);
						var d = sqrt(d2);
						var dxd = dx / d, dyd = dy / d;

						// apply attractive force across the connection
						if (v.ownsConnectionWith(u)) {
							var attractiveForce = log(pow(d, that.gravity) / (v.connections() + u.connections()));
							var moveX = attractiveForce * dxd, moveY = attractiveForce * dyd;

							v.move(-moveX, -moveY);
							u.move(moveX, moveY);
						}

						// apply repulsive force between every node
						var repulsiveForce = that.antiGravity * v.getScore() * u.getScore() / d2;
						var df = (v.getRadius() + u.getRadius() + that.antiGravityEffectiveReach) - d;

						if (df > 0)
							repulsiveForce *= log(df);

						v.move(repulsiveForce * dxd, repulsiveForce * dyd);
					}
				});

				var p = that.padding;
				var r = v.getRadius();
				var x = v.getX();
				var y = v.getY();
				var minXY = r + p;
				var maxX = that.width - r - p;
				var maxY = that.height - r - p;

				if (x < minXY) {
					v.setX(minXY);
				} else if (x > maxX) {
					v.setX(maxX);
				}

				if (y < minXY) {
					v.setY(minXY);
				} else if (y > maxY) {
					v.setY(maxY);
				}
			});

			if (that.animate) {
				that.redrawFunc();
			}

			if (that.currentStep == that.finalStep) {
				that.anim.stop();
				that.onComplete();
			}
		}

		this.anim = new Kinetic.Animation({ func: this._onStep });
	}

	w.ForceDirectedLayout.prototype = {
		run : function(steps, animate) {
			this.currentStep = 0;
			this.finalStep = steps;
			this.animate = animate;

			if (animate) {
				this.anim.start();
			} else {
				this._onStep.repeat(steps);
				this.redrawFunc();
				this.onComplete();
			}
		}
	}
})(window, Math.log, Math.pow, Math.sqrt);


text:
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _pure = require('recompose/pure');

var _pure2 = _interopRequireDefault(_pure);

var _SvgIcon = require('../../SvgIcon');

var _SvgIcon2 = _interopRequireDefault(_SvgIcon);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var HardwareLaptopWindows = function HardwareLaptopWindows(props) {
  return _react2.default.createElement(
    _SvgIcon2.default,
    props,
    _react2.default.createElement('path', { d: 'M20 18v-1c1.1 0 1.99-.9 1.99-2L22 5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2v1H0v2h24v-2h-4zM4 5h16v10H4V5z' })
  );
};
HardwareLaptopWindows = (0, _pure2.default)(HardwareLaptopWindows);
HardwareLaptopWindows.displayName = 'HardwareLaptopWindows';

exports.default = HardwareLaptopWindows;


text:
package com.aluxian.tweeather.scripts

import org.apache.spark.Logging

/**
  * This script is used to count the number of rows that [[TwitterEmoCollector]] has collected.
  */
object TwitterEmoCounter extends Script with Logging {

  override def main(args: Array[String]) {
    super.main(args)

    // Import data
    logInfo("Parsing text files")
    val data = sc.textFile("/tw/sentiment/emo/collected/*.text")

    // Print count
    logInfo(s"Count = ${data.count()}")
    sc.stop()
  }

}


text:
package com.amazonaws.services.redshift.model;

import java.io.Serializable;

/**
 *

 * Describes an AWS customer account authorized to restore a snapshot.
 *

 */
public class AccountWithRestoreAccess implements Serializable, Cloneable {

    /**
     * The identifier of an AWS customer account authorized to restore a
     * snapshot.
     */
    private String accountId;

    /**
     * The identifier of an AWS customer account authorized to restore a
     * snapshot.
     *
     * @return The identifier of an AWS customer account authorized to restore a
     *         snapshot.
     */
    public String getAccountId() {
        return accountId;
    }

    /**
     * The identifier of an AWS customer account authorized to restore a
     * snapshot.
     *
     * @param accountId The identifier of an AWS customer account authorized to restore a
     *         snapshot.
     */
    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }

    /**
     * The identifier of an AWS customer account authorized to restore a
     * snapshot.
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param accountId The identifier of an AWS customer account authorized to restore a
     *         snapshot.
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public AccountWithRestoreAccess withAccountId(String accountId) {
        this.accountId = accountId;
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getAccountId() != null) sb.append("AccountId: " + getAccountId() );
        sb.append("}");
        return sb.toString();
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getAccountId() == null) ? 0 : getAccountId().hashCode());
        return hashCode;
    }

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

        if (obj instanceof AccountWithRestoreAccess == false) return false;
        AccountWithRestoreAccess other = (AccountWithRestoreAccess)obj;

        if (other.getAccountId() == null ^ this.getAccountId() == null) return false;
        if (other.getAccountId() != null && other.getAccountId().equals(this.getAccountId()) == false) return false;
        return true;
    }

    @Override
    public AccountWithRestoreAccess clone() {
        try {
            return (AccountWithRestoreAccess) super.clone();

        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException(
                    "Got a CloneNotSupportedException from Object.clone() "
                    + "even though we're Cloneable!",
                    e);
        }

    }

}


text:
package guru.nidi.ramlproxy.core;

import guru.nidi.ramlproxy.report.ReportSaver;
import guru.nidi.ramltester.core.RamlReport;

public interface CommandContext {
    void reloadRamlDefinition();

    RamlReport validateRaml();

    void stopProxy() throws Exception;

    ReportSaver getSaver();
}


text:
/*
 * Given a string, find the length of the longest substring without repeating characters.
 */

/**
 * @param {string} s
 * @return {number}
 */
function lengthOfLongestSubstring(s) {
    const chars = Array.from(s);

    let length = [];
    let saved = [];
    let index;

    chars.forEach((char, i) => {
        index = saved.indexOf(char);
        if (index !== -1) {
            length.push(saved.length);
            saved.splice(0, index + 1);
        }
        saved.push(char);
    });
    length.push(saved.length);
    return Math.max(...length);
}

module.exports = lengthOfLongestSubstring;


text:
package volume

import (
	"fmt"

	"golang.org/x/net/context"

	"github.com/docker/docker/api/client"
	"github.com/docker/docker/api/types"
	"github.com/docker/docker/cli"
	"github.com/docker/docker/opts"
	runconfigopts "github.com/docker/docker/runconfig/opts"
	"github.com/spf13/cobra"
)

type createOptions struct {
	name       string
	driver     string
	driverOpts opts.MapOpts
	labels     []string
}

func newCreateCommand(dockerCli *client.DockerCli) *cobra.Command {
	opts := createOptions{
		driverOpts: *opts.NewMapOpts(nil, nil),
	}

	cmd := &cobra.Command{
		Use:   "create [OPTIONS] [VOLUME]",
		Short: "Create a volume",
		Long:  createDescription,
		Args:  cli.RequiresMaxArgs(1),
		RunE: func(cmd *cobra.Command, args []string) error {
			if len(args) == 1 {
				if opts.name != "" {
					fmt.Fprint(dockerCli.Err(), "Conflicting options: either specify --name or provide positional arg, not both\n")
					return cli.StatusError{StatusCode: 1}
				}
				opts.name = args[0]
			}
			return runCreate(dockerCli, opts)
		},
	}
	flags := cmd.Flags()
	flags.StringVarP(&opts.driver, "driver", "d", "local", "Specify volume driver name")
	flags.StringVar(&opts.name, "name", "", "Specify volume name")
	flags.Lookup("name").Hidden = true
	flags.VarP(&opts.driverOpts, "opt", "o", "Set driver specific options")
	flags.StringSliceVar(&opts.labels, "label", []string{}, "Set metadata for a volume")

	return cmd
}

func runCreate(dockerCli *client.DockerCli, opts createOptions) error {
	client := dockerCli.Client()

	volReq := types.VolumeCreateRequest{
		Driver:     opts.driver,
		DriverOpts: opts.driverOpts.GetAll(),
		Name:       opts.name,
		Labels:     runconfigopts.ConvertKVStringsToMap(opts.labels),
	}

	vol, err := client.VolumeCreate(context.Background(), volReq)
	if err != nil {
		return err
	}

	fmt.Fprintf(dockerCli.Out(), "%s\n", vol.Name)
	return nil
}

var createDescription = `
Creates a new volume that containers can consume and store data in. If a name
is not specified, Docker generates a random name. You create a volume and then
configure the container to use it, for example:

    $ docker volume create hello
    hello
    $ docker run -d -v hello:/world busybox ls /world

The mount is created inside the container's **/src** directory. Docker doesn't
not support relative paths for mount points inside the container.

Multiple containers can use the same volume in the same time period. This is
useful if two containers need access to shared data. For example, if one
container writes and the other reads the data.

## Driver specific options

Some volume drivers may take options to customize the volume creation. Use the
**-o** or **--opt** flags to pass driver options:

    $ docker volume create --driver fake --opt tardis=blue --opt timey=wimey

These options are passed directly to the volume driver. Options for different
volume drivers may do different things (or nothing at all).

The built-in **local** driver on Windows does not support any options.

The built-in **local** driver on Linux accepts options similar to the linux
**mount** command:

    $ docker volume create --driver local --opt type=tmpfs --opt device=tmpfs --opt o=size=100m,uid=1000

Another example:

    $ docker volume create --driver local --opt type=btrfs --opt device=/dev/sda2

`


text:
<?php

/**
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

declare(strict_types = 1);

namespace Google\Web_Stories\Media\Video;

use Google\Web_Stories\Infrastructure\HasMeta;
use Google\Web_Stories\Infrastructure\PluginUninstallAware;
use Google\Web_Stories\Service_Base;

/**
 * Class Is_Gif
 */
class Is_Gif extends Service_Base implements HasMeta, PluginUninstallAware {
	/**
	 * The post meta key.
	 */
	public const IS_GIF_POST_META_KEY = 'web_stories_is_gif';

	/**
	 * Init.
	 *
	 * @since 1.23.0
	 */
	public function register(): void {
		$this->register_meta();
	}

	/**
	 * Register post meta
	 *
	 * @since 1.23.0
	 */
	public function register_meta(): void {
		register_post_meta(
			'attachment',
			self::IS_GIF_POST_META_KEY,
			[
				'sanitize_callback' => 'rest_sanitize_boolean',
				'type'              => 'boolean',
				'description'       => __( 'Whether the video is to be considered a GIF', 'web-stories' ),
				'show_in_rest'      => true,
				'default'           => false,
				'single'            => true,
				'object_subtype'    => 'attachment',
			]
		);
	}

	/**
	 * Filters the attachment data prepared for JavaScript.
	 *
	 * @since 1.23.0
	 *
	 * @param array|mixed $response Array of prepared attachment data.
	 * @return array|mixed Response data.
	 */
	public function wp_prepare_attachment_for_js( $response ) {
		if ( ! \is_array( $response ) ) {
			return $response;
		}

		/**
		 * Post ID.
		 *
		 * @var int $post_id
		 */
		$post_id = $response['id'];

		$response[ self::IS_GIF_POST_META_KEY ] = get_post_meta( $post_id, self::IS_GIF_POST_META_KEY, true );

		return $response;
	}

	/**
	 * Act on plugin uninstall.
	 *
	 * @since 1.26.0
	 */
	public function on_plugin_uninstall(): void {
		delete_post_meta_by_key( self::IS_GIF_POST_META_KEY );
	}
}


text:
#pragma once
#include <aws/acm-pca/ACMPCA_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>

namespace Aws
{
namespace ACMPCA
{
namespace Model
{
  enum class KeyAlgorithm
  {
    NOT_SET,
    RSA_2048,
    RSA_4096,
    EC_prime256v1,
    EC_secp384r1
  };

namespace KeyAlgorithmMapper
{
AWS_ACMPCA_API KeyAlgorithm GetKeyAlgorithmForName(const Aws::String& name);

AWS_ACMPCA_API Aws::String GetNameForKeyAlgorithm(KeyAlgorithm value);
} // namespace KeyAlgorithmMapper
} // namespace Model
} // namespace ACMPCA
} // namespace Aws


text:
<?php

namespace Cocorico\UserBundle\Validator\Constraints;

use Cocorico\UserBundle\Entity\User as UserEntity;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator;

class UserValidator extends ConstraintValidator
{

    private $maxImages;
    private $minImages;

    /**
     * @param $maxImages
     * @param $minImages
     */
    public function __construct($maxImages, $minImages)
    {
        $this->maxImages = $maxImages;
        $this->minImages = $minImages;
    }

    /**
     * @param UserEntity $user
     * @param Constraint $constraint
     */
    public function validate($user, Constraint $constraint)
    {
        /** @var UserEntity $user */
        /** @var \Cocorico\UserBundle\Validator\Constraints\User $constraint */

        //Images
        if ($user->getImages()->count() > $this->maxImages) {
            $this->context->buildViolation($constraint::$messageMaxImages)
                ->atPath('image[new]')
                ->setParameter('{{ max_images }}', $this->maxImages)
                ->setTranslationDomain('cocorico_validators')
                ->addViolation();
        }

//        if ($user->getImages()->count() < $this->minImages) {
//            $this->context->buildViolation($constraint->messageMinImages)
//                ->atPath('images_new')
//                ->setParameter('{{ min_images }}', $this->minImages)
//                ->setTranslationDomain('cocorico_validators')
//                ->addViolation();
//        }

    }

}


text:
/**
 * @file
 *   This file implements gcc-specific startup code for the efr32.
 */

__extension__ typedef int __guard __attribute__((mode(__DI__)));
int __cxa_guard_acquire(__guard *g) { return !*(char *)(g); }
void __cxa_guard_release(__guard *g) { *(char *)g = 1; }
void __cxa_guard_abort(__guard *g) { (void)g; }
void __cxa_pure_virtual(void) { while (1); }


text:
#include "RESTHandler.h"

namespace librestpp {

RESTHandler::RESTHandler() {

}

RESTHandler::~RESTHandler() {

}

}


text:
source ./prod-env.sh
docker stack deploy -c ../fc-wb/docker-compose.yml fc_wb


text:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:orderInCategory="100"
        android:showAsAction="never" />
  <item android:id="@+id/action_refresh"
        android:icon="@drawable/ic_action_refresh"
        android:title="@string/refresh"
        android:orderInCategory="100"
        android:showAsAction="always" />
</menu>


text:
package scala.sprinter.printers

import java.io.{StringWriter, PrintWriter}
import scala.reflect.internal.Flags._
import scala.reflect.internal._
import scala.reflect.internal.util.{SourceFile, Statistics}
import scala.collection.mutable

object PrettyPrinters{
  private[PrettyPrinters] trait PrinterDescriptor
  object AFTER_NAMER extends PrinterDescriptor
  object AFTER_TYPER extends PrinterDescriptor

  def apply(compiler: Reflect) = {
    new PrettyPrinters {
      val global = compiler
    }
  }

  type Reflect = SymbolTable
}

trait PrettyPrinters {

  import PrettyPrinters.Reflect
  val global: Reflect
  import global._

  //TODO set printMultiline for false
  def show(what: Reflect#Tree, printerType: PrettyPrinters.PrinterDescriptor = PrettyPrinters.AFTER_NAMER, printMultiline: Boolean = false, decodeNames: Boolean = false) = {
    val buffer = new StringWriter()
    val writer = new PrintWriter(buffer)

    var printer = printerType match {
      case PrettyPrinters.AFTER_NAMER => new PrettyPrinter(writer, printMultiline, decodeNames)
      case PrettyPrinters.AFTER_TYPER | _ => new AfterTyperPrinter(writer, printMultiline, decodeNames)
    }

    printer.print(what)
    writer.flush()
    buffer.toString
  }

  protected def compareNames(name1: Reflect#Name, name2: Reflect#Name) =
    !Option(name1).isEmpty && !Option(name2).isEmpty && (name1.toString.trim == name2.toString.trim)

  //TODO change printMultiline (introduce class for settings) - to pass all parameters
  class PrettyPrinter(out: PrintWriter, printMultiline: Boolean = false, decodeNames: Boolean = true) extends global.TreePrinter(out) {
    //TODO maybe we need to pass this stack when explicitly run show inside print
    val contextStack = scala.collection.mutable.Stack[Tree]()

    override def printModifiers(tree: Tree, mods: Modifiers): Unit = printModifiers(mods, false)

    def printModifiers(mods: Modifiers, isCtr: Boolean): Unit =
      if (getCurrentContext().isEmpty || modsAccepted)
        printFlags(mods, isCtr)
      else
        List(IMPLICIT, CASE, LAZY, SEALED).foreach{flag =>
          if(mods.hasFlag(flag)) print(s"${mods.flagBitsToString(flag)} ")}

    def modsAccepted = getCurrentContext() map {
      case _:ClassDef | _:ModuleDef | _:Template | _:PackageDef => true
      case _ => false
    } getOrElse false

    def printFlags(mods: Modifiers, isCtr: Boolean = false) {
      val base = PROTECTED | OVERRIDE | PRIVATE | ABSTRACT | FINAL | SEALED | LAZY | LOCAL
      val mask = if (isCtr) base else base | IMPLICIT

      val s = mods.flagString(mask)
      if (s != "") print(s + " ")
      //case flag should be the last
      if (mods.isCase) print(mods.flagBitsToString(CASE) + " ")
      if (mods.isAbstractOverride) print("abstract override ")
    }

    def printConstrParams(ts: List[ValDef], isConstr: Boolean) {
      codeInParantheses(){
        if (!ts.isEmpty && ts.head.mods.isImplicit) print(s"${ts.head.mods.flagBitsToString(IMPLICIT)} ")
        printSeq(ts) {
          printParam(_, true)
        } { print(", ") }
      }
    }

    override def printValueParams(ts: List[ValDef]) {
      printValueParams(ts, false)
    }

    def printValueParams(ts: List[ValDef], isFuncTree: Boolean) {
      //val a: Int => Int = implicit x => x //parantheses are not allowed here
      val printParanthesis = !isFuncTree || {
        ts match {
          case List(vd: ValDef) => !vd.mods.isImplicit
          case _ => true
        }
      }

      if (printParanthesis)
        super.printValueParams(ts)
      else {
        if (!ts.isEmpty && ts.head.mods.isImplicit) print(s"${ts.head.mods.flagBitsToString(IMPLICIT)} ")
        printSeq(ts) {
          printParam
        } { print(", ") }
      }
    }

    def printParam(tree: Tree, isConstr: Boolean) {
      tree match {
        case ValDef(mods, name, tp, rhs) =>
          printAnnotations(tree)
          if (isConstr) {
            printModifiers(mods, isConstr)
          }
          print(if (mods.isMutable && isConstr) "var " else if (isConstr) "val " else "", symbName(tree, name));
          if (name.endsWith("_")) print(" ");
          printOpt(": ", tp);
          printOpt(" = ", rhs)
        case _ => super.printParam(tree)
      }
    }

    override def printParam(tree: Tree) {
      printParam(tree, false)
    }

    override def printAnnotations(tree: Tree) {
      val annots = tree.asInstanceOf[MemberDef].mods.annotations
      annots foreach {
        case Apply(Select(New(tree), p), args) => val ap = Apply(tree, args)
          print("@", ap, " ")
        case ann => print("@" + ann + " ")
      }
    }

    override def printTypeParams(ts: List[TypeDef]) {
      if (!ts.isEmpty) {
        print("["); printSeq(ts){ t =>
          printAnnotations(t)
          if (t.mods.hasFlag(CONTRAVARIANT)) {
            print("-")
          } else if (t.mods.hasFlag(COVARIANT)) {
            print("+")
          }
          printParam(t)
        }{print(", ")}; print("]")
      }
    }

    def codeInParantheses(condition: Boolean = true)(body: =>Unit) {
      if (condition) print("(")
      body
      if (condition) print(")")
    }

    def specialTreeContext(context: Tree)(iIf: Boolean = true, iMatch: Boolean = true,
        iTry: Boolean = true, iAnnotated: Boolean = true, iBlock: Boolean = true, iLabelDef: Boolean = true) = {
      context match {
        case _: If => iIf
        case _: Match => iMatch
        case _: Try => iTry
        case _: Annotated => iAnnotated
        case _: Block => iBlock
        case _: LabelDef => iLabelDef
        case _ => false
      }
    }

    protected def isIntLitWithDecodedOp(qual: Tree, name: Name) = {
      lazy val qualIsIntLit = qual match {
        case Literal(x) => x.value.isInstanceOf[Int]
        case _ => false
      }
      decodeNames && qualIsIntLit && name.isOperatorName
    }

    protected def blankBeforeOperatorName(name: Name) =
      if (name.isOperatorName) " " else ""

    //Danger while using inheritance: it's hidden (overwritten) method
    def backquotedPath(t: Tree): String = {
      t match {
        case Select(qual, name) if (name.isTermName && specialTreeContext(qual)(iLabelDef = false)) || isIntLitWithDecodedOp(qual, name) => "(%s).%s".format(backquotedPath(qual), symbName(t, name))
        case Select(qual, name) if name.isTermName  => "%s.%s".format(backquotedPath(qual), symbName(t, name))
        case Select(qual, name) if name.isTypeName  => s"%s#${blankBeforeOperatorName(name)}%s".format(backquotedPath(qual), symbName(t, name))
        case Ident(name)                            => symbName(t, name)
        case _                                      =>
          val typeOfPrinter = if (this.isInstanceOf[AfterTyperPrinter]) PrettyPrinters.AFTER_TYPER else PrettyPrinters.AFTER_NAMER
            show(t, typeOfPrinter, printMultiline, decodeNames)
      }
    }

    def contextManaged(context: Tree)(body: =>Unit) {
      contextStack.push(context)
      body
      contextStack.pop()
    }

    def getCurrentContext() = if (!contextStack.isEmpty) Some(contextStack.top) else None

    def removeDefaultTypesFromList(trees: List[Tree])(classesToRemove: List[String])(traitsToRemove: List[String]) =
      removeDefaultTraitsFromList(removeDefaultClassesFromList(trees, classesToRemove), traitsToRemove)

    def removeDefaultClassesFromList(trees: List[Tree], classesToRemove: List[String]) = trees filter {
      case Select(Ident(sc), name) => !((classesToRemove.contains(name.toString)) && (sc.toString == "scala"))
      case _ => true
    }

    def removeDefaultTraitsFromList(trees: List[Tree], traitsToRemove: List[String]): List[Tree] =
      trees match {
        case Nil => trees
        case list : List[Tree] => list.last match {
          case Select(Ident(sc), name) if ((traitsToRemove.contains(name.toString)) && (sc.toString == "scala"))
            => removeDefaultTraitsFromList(list.init, traitsToRemove)
          case _ => list
         }
      }

    def getPrimaryConstr(methods: List[Tree]) =
      methods collectFirst {
        case dd: DefDef if dd.name.toString.trim == nme.CONSTRUCTOR.toString.trim => dd
      }

    // Is this selector remapping a name (i.e, {name1 => name2})
    protected def isNotRemap(s: ImportSelector): Boolean =
      (compareNames(s.name, nme.WILDCARD) || compareNames(s.name, s.rename))

    protected def selectorToString(s: ImportSelector): String = {
      val from = quotedName(s.name)
      if (isNotRemap(s)) from
      else from + "=>" + quotedName(s.rename)
    }

    override def printTree(tree: Tree) {
      tree match {
        case ClassDef(mods, name, tparams, impl) =>
          contextManaged(tree){
            printAnnotations(tree)
            val word =
              if (mods.isTrait){
                printModifiers(tree, mods &~ ABSTRACT) // avoid abstract modifier for traits
                "trait"
              } else {
                printModifiers(tree, mods)
                "class"
              }

            print(word, " ", symbName(tree, name))
            printTypeParams(tparams)

            val Template(parents @ List(_*), self, methods) = impl
            if (!mods.isTrait) {
              val templateVals = methods collect {
                case ValDef(mods, name, _, _) => (name, mods)
              }

              val primaryConstrOpt = getPrimaryConstr(methods)

              primaryConstrOpt map {
                primaryConstr =>

                val cstrMods = primaryConstr.mods
                val vparamss = primaryConstr.vparamss

                //combine modifiers
                val printParamss =
                  vparamss map {
                    vparams =>
                      if (vparams.isEmpty) vparams
                      else vparams map {
                        vparam =>
                          templateVals find {
                            tv =>
                              compareNames(tv._1, vparam.name)
                          } map {
                            templateVal =>
                              ValDef(Modifiers(vparam.mods.flags | templateVal._2.flags, templateVal._2.privateWithin,
                                (vparam.mods.annotations ::: templateVal._2.annotations) distinct), vparam.name, vparam.tpt, vparam.rhs)
                          } getOrElse vparam
                      }
                    }

                //constructor's modifier
                if (cstrMods.hasFlag(AccessFlags)) {
                  print(" ")
                  printModifiers(primaryConstr, cstrMods)
                }

                //constructor's params
                printParamss foreach { printParams =>
                  //don't print single empty constructor param list
                  if (!(printParams.isEmpty && printParamss.size == 1) || cstrMods.hasFlag(AccessFlags)) {
                    printConstrParams(printParams, true)
                    print(" ")
                  }
                }
              } getOrElse {print(" ")}
            }

            //get trees without default classes and traits (when they are last)
            val printedParents = removeDefaultTypesFromList(parents)(List("AnyRef"))(if (mods.hasFlag(CASE)) List("Product", "Serializable") else Nil)

            print(if (mods.isDeferred) "<: " else if (!printedParents.isEmpty) " extends "
              else "", impl)
          }

        case PackageDef(packaged, stats) =>
          contextManaged(tree){
            packaged match {
              case Ident(name) if compareNames(name, nme.EMPTY_PACKAGE_NAME) =>
                printSeq(stats) {
                  print(_)
                } {
                  print(";");
                  println()
                };
              case _ =>
                printAnnotations(tree)
                print("package ", packaged);
                printColumn(stats, " {", "\n", "}")
            }
          }

        case ModuleDef(mods, name, impl) =>
          contextManaged(tree){
            printAnnotations(tree)
            printModifiers(tree, mods);
            val Template(parents @ List(_*), self, methods) = impl
            val parentsWAnyRef = removeDefaultClassesFromList(parents, List("AnyRef"))
            print("object " + symbName(tree, name), if (!parentsWAnyRef.isEmpty) " extends " else "", impl)
          }

        case vd@ValDef(mods, name, tp, rhs) =>
          printAnnotations(tree)
          printModifiers(tree, mods)
          print(if (mods.isMutable) "var " else "val ", symbName(tree, name))
          if (name.endsWith("_")) print(" ")

          printOpt(
            // place space after symbolic def name (val *: Unit does not compile)
            (if(symbName(tree, name) != symbName(tree, name,false) || symbName(tree, name) != symbName(tree, name, true))
              " "
            else
              "") +
            ": ",
            tp
          )
          contextManaged(tree){
            if (!mods.isDeferred)
              print(" = ", if (rhs.isEmpty) "_" else rhs)
          }

        case dd@DefDef(mods, name, tparams, vparamss, tp, rhs) =>
          printAnnotations(tree)
          printModifiers(tree, mods)
          print("def " + symbName(tree, name))
          printTypeParams(tparams);
          vparamss foreach printValueParams
          if (tparams.isEmpty && (vparamss.isEmpty || vparamss(0).isEmpty) && name.endsWith("_"))
            print(" ")
          printOpt(
            // place space after symbolic def name (def *: Unit does not compile)
            (if(symbName(tree, name) != symbName(tree, name,false) || symbName(tree, name) != symbName(tree, name, true))
              " "
            else
              "") +
            ": ",
            tp
          )
          contextManaged(tree){
            printOpt(" = " + (if (mods.hasFlag(MACRO)) "macro " else ""), rhs)
          }

        case td@TypeDef(mods, name, tparams, rhs) =>
          if (mods hasFlag (PARAM | DEFERRED)) {
            printAnnotations(tree)
            printModifiers(tree, mods);
            print("type ");
            printParam(tree)
          } else {
            printAnnotations(tree)
            printModifiers(tree, mods);
            print("type " + symbName(tree, name))
            printTypeParams(tparams);
            contextManaged(tree){
              printOpt(" = ", rhs)
            }
          }

        case LabelDef(name, params, rhs) =>
          if (name.contains("while$")) {
            contextManaged(tree){
              val If(cond, thenp, elsep) = rhs
              print("while (", cond, ") ")
              val Block(list, wh) = thenp
              printColumn(list, "", ";", "")
            }
          } else if (name.contains("doWhile$")) {
            contextManaged(tree){
              val Block(bodyList: List[Tree], ifCond @ If(cond, thenp, elsep)) = rhs
              print("do ")
              printColumn(bodyList, "", ";", "")
              print(" while (", cond, ") ")
            }
          } else {
            print(symbName(tree, name)); printLabelParams(params);
            contextManaged(tree){
              printBlock(rhs)
            }
          }

        case Import(expr, selectors) =>
          print("import ", backquotedPath(expr), ".")
          selectors match {
            case List(s) =>
              // If there is just one selector and it is not remapping a name, no braces are needed
              if (isNotRemap(s)) print(selectorToString(s))
              else print("{", selectorToString(s), "}")
            // If there is more than one selector braces are always needed
            case many =>
              print(many.map(selectorToString).mkString("{", ", ", "}"))
          }

        case Template(parents, self, body) =>

          val printedParents =
            getCurrentContext() map {
              //val example: Option[AnyRef => Product1[Any] with AnyRef] = ... - CompoundTypeTree with template
              case _: CompoundTypeTree => parents
              case ClassDef(mods, name, _, _) if mods.hasFlag(CASE) => removeDefaultTypesFromList(parents)(List("AnyRef"))(List("Product", "Serializable"))
              case _ => removeDefaultClassesFromList(parents, List("AnyRef"))
            } getOrElse(parents)

          val primaryCtrOpt = getPrimaryConstr(body)
          var ap: Option[Apply] = None

          for (primaryCtr <- primaryCtrOpt) {
            primaryCtr match {
              case DefDef(_, _, _, _, _, Block(ctBody @ List(_*), _)) =>
                ap = ctBody collectFirst {
                  case apply: Apply => apply
                }

                //vals in preinit blocks
                val presuperVals = ctBody filter {
                  case vd:ValDef => vd.mods.hasFlag(PRESUPER)
                  case _ => false
                }

                if (!presuperVals.isEmpty) {
                  print("{")
                  printColumn(presuperVals, "", ";", "")
                  print("} " + (if (!printedParents.isEmpty) "with " else ""))
                }

              case _ =>
            }
          }

          if (!printedParents.isEmpty) {
            val (clParent :: traits) = printedParents
            print(clParent)

            def getConstrParams(tree: Tree, cargs: List[List[Tree]]): List[List[Tree]] = {
              tree match {
                case Apply(inTree, args) =>
                  getConstrParams(inTree, cargs):+args
                case _ => cargs
              }
            }

            val applyParamsList = ap map {getConstrParams(_, Nil)} getOrElse Nil
            applyParamsList foreach {x: List[Tree] => if (!(x.isEmpty && applyParamsList.size == 1)) printRow(x, "(", ", ", ")")}

            if (!traits.isEmpty) {
              printRow(traits, " with ", " with ", "")
            }
          }
          //remove primary constr def and constr val and var defs
          //right contains all constructors
          //TODO see impl filter on Tree
          val (left, right) = body.filter {
            //remove valdefs defined in constructor and pre-init block
            case vd: ValDef => !vd.mods.hasFlag(PARAMACCESSOR) && !vd.mods.hasFlag(PRESUPER)
            case dd: DefDef => !compareNames(dd.name, nme.MIXIN_CONSTRUCTOR) //remove $this$ from traits
            case EmptyTree => false
            case _ => true
          } span {
            case dd: DefDef => !compareNames(dd.name, nme.CONSTRUCTOR)
            case _ => true
          }

          val modBody = left ::: right.drop(1)//List().drop(1) ==> List()
          val showBody = !(modBody.isEmpty &&
            (self match {
              case ValDef(mods, name, TypeTree(), rhs) if (mods & PRIVATE) != 0 && name.decoded == "_" && rhs.isEmpty => true // workaround for superfluous ValDef when parsing class without body using quasi quotes
              case _ => self.isEmpty
            }))
          if (showBody) {
            if (!compareNames(self.name, nme.WILDCARD)) {
              print(" { ", self.name);
              printOpt(": ", self.tpt);
              print(" =>")
            } else if (!self.tpt.isEmpty) {
              print(" { _ : ", self.tpt, " =>")
            } else {
              print(" {")
            }
            contextManaged(tree) {
              printColumn(modBody, "", ";", "}")
            }
          }

        case Block(stats, expr) =>
          contextManaged(tree){
            printColumn(stats ::: List(expr), "{", ";", "}")
          }

        case Match(selector, cases) =>
          //insert braces if match is inner
          //make this function available for other casses
          //passing required type for checking
          def insertBraces(body: =>Unit) {
            if (contextStack.exists{
              _.isInstanceOf[Match]
            }) {
                print("(")
                body
                print(")")
            } else body
          }

          val printParantheses = specialTreeContext(selector)(iLabelDef = false)
          tree match {
            case Match(EmptyTree, cs) =>
              printColumn(cases, "{", "", "}")
            case _ =>
              insertBraces {
                contextManaged(tree){
                  codeInParantheses(printParantheses) {
                    print(selector);
                  }
                }
                printColumn(cases, " match {", "", "}")
              }
          }

        case CaseDef(pat, guard, body) =>
          print("case ")
          def patConstr(pat: Tree): Tree = pat match {
            case Apply(fn, args) => patConstr(fn)
            case _ => pat
          }

          print(pat);
          printOpt(" if ", guard)
          contextManaged(tree) {
            print(" => ", body)
          }

        case Star(elem) =>
          print(elem, "*")

        case Bind(name, t) =>
          if (t == EmptyTree) print("(", symbName(tree, name), ")")
          else if (t.exists{
            case _:Star => true
            case _ => false
          }) print(symbName(tree, name), " @ ", t)
          else print("(", symbName(tree, name), " @ ", t, ")")

        //almost the same as in original
        case Function(vparams, body) =>
          print("(");
          printValueParams(vparams, true);
          print(" => ", body, ")")

        case Typed(expr, tp) =>
          tp match {
            case Function(List(), EmptyTree) => print("(", expr, " _)") //func _
            case _ => print("((", expr, "): ", tp, ")") //parenteses required when (a match {}) : Type
          }

        case Apply(fun, vargs) =>
          //process methods ending on colon with multiple args list//
          //example:
//          def t[A,B](as: List[A]) = {
//            println("hello")
//            ((Map.empty[B, List[A]]) /: as){ (nels, a) => println(""); (nels)}
//          }
//         by default results in:
//        {
//          val x$1 = Map.empty[B, List[A]];
//          as.$div$colon(x$1)
//        }(((nels, a) => {
//          println("");
//          nels
//        }))
          tree match {
            //processing methods ending on colons (x \: list)
            case Apply(Block(l1 @ List(sVD :ValDef), a1 @ Apply(Select(_, methodName), l2 @ List(Ident(iVDName)))), l3 @ List(_*))
              if sVD.mods.hasFlag(SYNTHETIC) && methodName.toString.endsWith("$colon") && compareNames(sVD.name, iVDName) => //&& (sVD.name.toString.trim == iVDName.toString.trim) =>
              val printBlock = Block(l1, Apply(a1, l3))
              print(printBlock)
            case Apply(tree1, _) if (specialTreeContext(tree1)(iAnnotated = false)) => codeInParantheses(){print(fun)}; printRow(vargs, "(", ", ", ")")
            case _ => print(fun); printRow(vargs, "(", ", ", ")")
          }

        case Super(This(qual), mix) =>
          if (!qual.isEmpty || tree.symbol != NoSymbol) print(symbName(tree, qual) + ".")
          print("super")
          if (!mix.isEmpty)
            print("[" + mix + "]")

        case This(qual) =>
          //symName is redefined
          if (!qual.isEmpty) print(symbName(tree, qual) + ".")
          print("this")

        //case Select(apply: Apply, name) if (!settings.debug.value) =>
        //print(apply,".",symName(tree, name))

        case Select(qual@New(tpe), name) =>
          print(qual)

        case Select(qualifier, name) => {
          val printParantheses = specialTreeContext(qualifier)(iAnnotated = false) || isIntLitWithDecodedOp(qualifier, name)
          if (printParantheses) print("(", backquotedPath(qualifier), ").", symbName(tree, name))
          else print(backquotedPath(qualifier), ".", symbName(tree, name))
        }

        case id@Ident(name) =>
          if (!name.isEmpty) {
            val str = symbName(tree, name)

            val strIsBackquoted = str.startsWith("`") && str.endsWith("`")

            print(if (id.isBackquoted && !strIsBackquoted) "`" + str + "`" else str)
          }
          else {
            print("")
          }

        case l@Literal(x) =>
          //TODO refactor multiline string processing - x.stringValue
          if (x.value.isInstanceOf[String] && printMultiline && x.stringValue.contains("\n") && !x.stringValue.contains("\"\"\"") && x.stringValue.size > 1) {
            val splitValue = x.stringValue.split('\n'.toString).toList
            val multilineStringValue = if (x.stringValue.endsWith("\n")) splitValue :+ "" else splitValue
            val trQuotes = "\"\"\""
            print(trQuotes); printSeq(multilineStringValue){print(_)}{print("\n")}; print(trQuotes)
          } else {
            //processing Float constants
            val printValue = x.escapedStringValue + (if (x.value.isInstanceOf[Float]) "F" else "") //correct printing of Float
            print(printValue)
          }

        case Annotated(Apply(Select(New(tpt), nme.CONSTRUCTOR), args), tree) =>
          def printAnnot() {
            print("@", tpt)
            if (!args.isEmpty)
              printRow(args, "(", ",", ")")
          }

          val printParantheses = specialTreeContext(tree)()
          codeInParantheses(printParantheses){print(tree)}; print(if (tree.isType) " " else ": ")
          printAnnot()

        case SelectFromTypeTree(qualifier, selector) =>
          print("(", qualifier, ")#", blankBeforeOperatorName(selector),symbName(tree, selector))

        case CompoundTypeTree(templ) =>
          contextManaged(tree){
            print(templ)
          }

        case AppliedTypeTree(tp, args) =>
          //it's possible to have (=> String) => String type but Function1[=> String, String] is not correct
          def containsByNameTypeParam =
            args exists {
                case AppliedTypeTree(Select(qual, name), _) => name.toString.trim.equals("<byname>")
                case _ => false
              }

          if (containsByNameTypeParam) {
            print("(")
            printRow(args.init, "(", ", ", ")")
            print(" => ", args.last, ")")
          } else {
            if (tp.exists {
              case Select(_, name) => compareNames(name, tpnme.REPEATED_PARAM_CLASS_NAME)
              case _ => false
            } && !args.isEmpty) {
              print(args(0), "*")
            } else if (tp match {
              case Select(_, name) => compareNames(name, tpnme.BYNAME_PARAM_CLASS_NAME)
              case _ => false
            }) {
              print("=> ", if (args.isEmpty) "()" else args(0))
            } else {
              print(tp);
              printRow(args, "[", ", ", "]")
            }
          }

        case ExistentialTypeTree(tpt, whereClauses) =>
          print("(", tpt);
          printColumn(whereClauses, " forSome { ", ";", "})")

        case tbt@TypeBoundsTree(lo, hi) => {
          val loDefault = "_root_.scala.Nothing"
          val hiDefault = "_root_.scala.Any"
          if (loDefault != lo.toString()) printOpt(" >: ", lo); if (hiDefault != hi.toString()) printOpt(" <: ", hi)
        }

        case emptyTree if emptyTree.toString == "<empty>" => // workaround as case EmptyTree does not work for all universes because of path depedent types

        case tree => super.printTree(tree)
      }
      //TODO remove
      if (printTypes && tree.isTerm && !tree.isEmpty) {
        print("{", if (tree.tpe eq null) "<null>" else tree.tpe.toString, "}")
      }
    }

    //Danger: it's overwritten method - can be problems with inheritance)
    def symbName(tree: Tree, name: Name, decoded: Boolean = decodeNames) = {
      val encName = name.encoded
      val decName = name.decoded
      def modifyEncoded(s: String) = if (decoded && (encName.contains("$u") ||
        (encName.contains("$") && decName.exists(ch => opSym.contains(ch)) && decName.exists(ch => !opSym.contains(ch)) && !excList.exists(str => decName.contains(str)))))
        "`%s`" format s else s

      if (compareNames(name, nme.CONSTRUCTOR)) "this"
      else modifyEncoded(quotedName(name, decoded))
    }

    val opSym = List('~', '=', '<', '>', '!', '#', '%', '^', '&', '|', '*', '/', '+', '-', ':', '\\', '?', '@')
    val excList = List("\\", "_*")

    override def print(args: Any*): Unit = {
      args foreach {
        arg =>
        //TODO repair issue with pattern matching, trees and vals of type Any
          if (arg.isInstanceOf[Tree]) { //problem with vars of type Any
          val treeArg = arg.asInstanceOf[Tree]
            printTree(treeArg)
          } else {
            arg match {
              case name: Name =>
                print(quotedName(name))
              case other => super.print(other)
            }
          }
      }
    }
  }

  class AfterTyperPrinter(out: PrintWriter, printMultiline: Boolean = false, decodeNames: Boolean = false) extends PrettyPrinter(out, printMultiline, decodeNames) {

    private val curClassOrModuleStack: mutable.Stack[Symbol] = mutable.Stack()
    private def pushClassOrModule(sym: Symbol) = curClassOrModuleStack.push(sym)
    //TODO refactor
    private def popClassOrModule: Option[Symbol] = if (!curClassOrModuleStack.isEmpty) Option(curClassOrModuleStack.pop) else None
    private def classContext = if (!curClassOrModuleStack.isEmpty) Option(curClassOrModuleStack.top) else None
    override def contextManaged(context: Tree)(body: =>Unit) {
      contextStack.push(context)
      val contIsClOrMod = context.isInstanceOf[ClassDef] || context.isInstanceOf[ModuleDef]
      if (contIsClOrMod) curClassOrModuleStack.push(context.symbol)
      body
      if (contIsClOrMod) curClassOrModuleStack.pop
      contextStack.pop()
    }

    override def symbName(tree: Tree, name: Name, decoded: Boolean = decodeNames) = {
      if (!compareNames(name, nme.CONSTRUCTOR)) super.symbName(tree, name, decoded).trim else "this"
    }

    override def printTree(tree: Tree) {
      tree match {
        case ClassDef(mods, name, tparams, impl) =>
          contextManaged(tree){
            printAnnotations(tree)
            val word =
              if (mods.isTrait){
                printModifiers(tree, mods &~ ABSTRACT) // avoid abstract modifier for traits
                "trait"
              } else {
                printModifiers(tree, mods)
                "class"
              }

            print(word, " ", symbName(tree, name))
            printTypeParams(tparams)

            val Template(parents @ List(_*), self, methods) = impl
            if (!mods.isTrait) {
              val templateVals = methods collect {
                case ValDef(mods, name, _, _) => (name, mods)
              }

              val accessors = methods collect {
                case dd@DefDef(mods, name, _, _, _, _) if dd.symbol.isGetter => (dd.name.decode.trim, dd.mods.flags)
              } toMap

              val primaryConstrOpt = getPrimaryConstr(methods)

              primaryConstrOpt map {
                primaryConstr =>

                  val cstrMods = primaryConstr.mods
                  val vparamss = primaryConstr.vparamss

                  //combine modifiers
                  val printParamss =
                    vparamss map {
                      vparams =>
                        if (vparams.isEmpty) vparams
                        else vparams map {
                          vparam =>
                            templateVals find {
                              tv =>
                                compareNames(tv._1, vparam.name)
                            } map {
                              templateVal =>
                                //if found in map remove private local and set flag
                                val vparName = vparam.name.toString.trim
                                val flags = if (accessors.contains(vparName))
                                  ((vparam.mods | templateVal._2.flags) &~ Flags.PrivateLocal | accessors(vparName)).flags
                                else (vparam.mods.flags | templateVal._2.flags)
                                ValDef(Modifiers(flags, templateVal._2.privateWithin,
                                  (vparam.mods.annotations ::: templateVal._2.annotations) distinct), vparam.name, vparam.tpt, vparam.rhs)
                            } getOrElse vparam
                        }
                    }

                  //constructor's modifier
                  if (cstrMods.hasFlag(AccessFlags)) {
                    print(" ")
                    printModifiers(primaryConstr, cstrMods)
                  }

                  //constructor's params
                  printParamss foreach { printParams =>
                  //don't print single empty constructor param list
                    if (!(printParams.isEmpty && printParamss.size == 1) || cstrMods.hasFlag(AccessFlags)) {
                      printConstrParams(printParams, true)
                      print(" ")
                    }
                  }
              } getOrElse {print(" ")}
            }

            //get trees without default classes and traits (when they are last)
            val printedParents = removeDefaultTypesFromList(parents)(List("AnyRef"))(if (mods.hasFlag(CASE)) List("Product", "Serializable") else Nil)

            print(if (mods.isDeferred) "<: " else if (!printedParents.isEmpty) " extends "
            else "", impl);
          }

        case PackageDef(packaged, stats) =>
          contextManaged(tree){
            val statsMod = stats.filter{
              case x => !x.symbol.isSynthetic
            }
            packaged match {
              case Ident(name) if compareNames(name, nme.EMPTY_PACKAGE_NAME) =>
                printSeq(statsMod) {
                  print(_)
                } {
                  print(";");
                  println()
                };
              case _ =>
                printAnnotations(tree)
                print("package ", packaged);
                printColumn(statsMod, " {", "\n", "}")
            }
          }

        case ModuleDef(mods, name, impl) =>
          contextManaged(tree){
            printAnnotations(tree)
            printModifiers(tree, mods);
            val Template(parents @ List(_*), self, methods) = impl
            val parentsWAnyRef = removeDefaultClassesFromList(parents, List("AnyRef"))
            print("object " + symbName(tree, name), if (!parentsWAnyRef.isEmpty) " extends " else "", impl);
          }

        case vd@ValDef(mods, name, tp, rhs) =>
          printAnnotations(tree)
          printModifiers(tree, mods)
          print(if (mods.isMutable) "var " else "val ", symbName(tree, name))
          if (name.endsWith("_")) print(" ")

          if (!isTreePrintable(tp)) {
          printOpt(
            // place space after symbolic def name (val *: Unit does not compile)
            returnIfCond(name.decoded.trim != name.encoded.trim)(" ") +
              ": ",
            tp
          )
          }
          contextManaged(tree){
            if (!mods.isDeferred)
              print(" = ", if (rhs.isEmpty) "_" else rhs);
          }

        case dd@DefDef(mods, name, tparams, vparamss, tp, rhs) =>
          printAnnotations(tree)
          printModifiers(tree, mods)
          print("def " + symbName(tree, name))
          printTypeParams(tparams);
          vparamss foreach printValueParams
          if (tparams.isEmpty && (vparamss.isEmpty || vparamss(0).isEmpty) && name.endsWith("_"))
            print(" ")

          if (!isTreePrintable(tp)) printOpt(
            // place space after symbolic def name (def *: Unit does not compile)
            returnIfCond(name.decoded.trim != name.encoded.trim)(" ") + ": ", tp)
          contextManaged(tree){
            printOpt(" = " + (if (mods.hasFlag(MACRO)) "macro " else ""), rhs);
          }

        case td@TypeDef(mods, name, tparams, rhs) =>
          if (mods hasFlag (PARAM | DEFERRED)) {
            printAnnotations(tree)
            printModifiers(tree, mods);
            print("type ");
            printParam(tree)
          } else {
            printAnnotations(tree)
            printModifiers(tree, mods);
            print("type " + symbName(tree, name))
            printTypeParams(tparams);
            contextManaged(tree){
              printOpt(" = ", rhs)
            }
          }

        case LabelDef(name, params, rhs) =>
          if (name.contains("while$")) {
            contextManaged(tree){
              val If(cond, thenp, elsep) = rhs
              print("while (", cond, ") ")
              val Block(list, wh) = thenp
              printColumn(list, "", ";", "")
            }
          } else if (name.contains("doWhile$")) {
            contextManaged(tree){
              val Block(bodyList: List[Tree], ifCond @ If(cond, thenp, elsep)) = rhs
              print("do ")
              printColumn(bodyList, "", ";", "")
              print(" while (", cond, ") ")
            }
          } else {
            print(symbName(tree, name)); printLabelParams(params);
            contextManaged(tree){
              printBlock(rhs)
            }
          }

        case Import(expr, selectors) =>
          print("import ", backquotedPath(expr), ".")
          selectors match {
            case List(s) =>
              // If there is just one selector and it is not remapping a name, no braces are needed
              if (isNotRemap(s)) print(selectorToString(s))
              else print("{", selectorToString(s), "}")
            // If there is more than one selector braces are always needed
            case many =>
              print(many.map(selectorToString).mkString("{", ", ", "}"))
          }

        case Template(parents, self, body) =>

          val printedParents =
            getCurrentContext() map {
              //val example: Option[AnyRef => Product1[Any] with AnyRef] = ... - CompoundTypeTree with template
              case _: CompoundTypeTree => parents
              case ClassDef(mods, name, _, _) if mods.hasFlag(CASE) => removeDefaultTypesFromList(parents)(List("AnyRef"))(List("Product", "Serializable"))
              case _ => removeDefaultClassesFromList(parents, List("AnyRef"))
            } getOrElse(parents)

          val primaryCtrOpt = getPrimaryConstr(body)
          var ap: Option[Apply] = None

          for (primaryCtr <- primaryCtrOpt) {
            primaryCtr match {
              case DefDef(_, _, _, _, _, Block(ctBody @ List(_*), _)) =>
                ap = ctBody collectFirst {
                  case apply: Apply => apply
                }

                //vals in preinit blocks
                //TODO typeDef not found
                val presuper = ctBody filter {
                  case vd:ValDef => vd.mods.hasFlag(PRESUPER)
                  case td: TypeDef => td.mods.hasFlag(PRESUPER)
                  case _ => false
                }

                if (!presuper.isEmpty) {
                  print("{")
                  printColumn(presuper, "", ";", "")
                  print("} " + (if (!printedParents.isEmpty) "with " else ""))
                }

              case _ =>
            }
          }

          if (!printedParents.isEmpty) {
            val (clParent :: traits) = printedParents
            print(clParent)

            def getConstrParams(tree: Tree, cargs: List[List[Tree]]): List[List[Tree]] = {
              tree match {
                case Apply(inTree, args) =>
                  getConstrParams(inTree, cargs):+args
                case _ => cargs
              }
            }

            val applyParamsList = ap map {getConstrParams(_, Nil)} getOrElse Nil
            applyParamsList foreach {x: List[Tree] => if (!(x.isEmpty && applyParamsList.size == 1)) printRow(x, "(", ", ", ")")}

            if (!traits.isEmpty) {
              printRow(traits, " with ", " with ", "")
            }
          }

          def showDef(dd: DefDef) = (((!dd.symbol.isGetter || dd.symbol.isDeferred)
            || dd.symbol.isLazy) && !dd.symbol.isSynthetic && !dd.symbol.isSetter)

          //remove primary constr def and constr val and var defs
          //right contains all constructors
          //TODO see impl filter on Tree
          val (left, right) = body.filter {
            //remove valdefs defined in constructor and pre-init block
            case vd: ValDef => !vd.mods.hasFlag(PARAMACCESSOR) && !vd.mods.hasFlag(PRESUPER)
            case dd: DefDef => !compareNames(dd.name, nme.MIXIN_CONSTRUCTOR) //remove $this$ from traits
            case EmptyTree => false
            case _ => true
          } span {
            case dd: DefDef => !compareNames(dd.name, nme.CONSTRUCTOR)
            case _ => true
          }

          val allBody = left ::: right.drop(1) //List().drop(1) ==> List() - remove default constr

          val dds = allBody filter {
              case dd:DefDef => dd.symbol.isAccessor
              case _ => false
            }

          val modBody = allBody filter {
            case dd: DefDef => showDef(dd)
            case vd: ValDef => !vd.symbol.isLazy //we transform lazy defs to val => remove lazy
            case _ => true
          } map {
            case vd @ ValDef(mods, name, tpt, rhs) =>
              dds find {
                case dd:DefDef => compareNames(vd.name, dd.name) && dd.symbol.isGetter
                case _ => false
              } map { dd =>
                val df@DefDef(dmods, _, _, _, _, drhs) = dd
                //clean dds specific options
                val defaultFlags = mods &~ Flags.PrivateLocal | dmods.flags
                val flags = if (df.symbol.isSetter) defaultFlags | Flags.MUTABLE else defaultFlags
                //TODO remove method flags
                ValDef(flags, name, tpt, rhs).setSymbol(vd.symbol) //set symbol of old valdef
              } getOrElse(vd)
            case dd @ DefDef(flags, name, _, _, tpt, rhs) if dd.symbol.isDeferred && dd.symbol.isAccessor => //abstract val and var processing
              //val isVar = dd.symbol.owner.tpe.members.find(sym => sym.isSetter && (sym.name.encode.toString == dd.name.encode + "_=")).isDefined  //java.lang.AssertionError: assertion failed: Race condition detected
              ValDef(dd.mods &~ Flags.METHOD &~ Flags.ACCESSOR | (if (dd.symbol.isSetter) Flags.MUTABLE else 0L), name, tpt, rhs).setSymbol(dd.symbol) //set symbol of old defdef
            case dd @ DefDef(flags, name, _, _, tpt, rhs) if dd.symbol.isLazy =>
              val newRhs = rhs match {  //most of lazy vals results in var and def that assign value to val
                  //but unit values result in only def
                case Block(List(Assign(lhs, res)), expr) => res //rewire
                case _ => rhs
              }
              ValDef(flags, name, tpt, newRhs).setSymbol(dd.symbol)
            case o@_ =>o
          }

        val showBody = !(modBody.isEmpty &&
            (self match {
              case ValDef(mods, name, TypeTree(), rhs) if (mods & PRIVATE) != 0 && name.decoded == "_" && rhs.isEmpty => true // workaround for superfluous ValDef when parsing class without body using quasi quotes
              case _ => self.isEmpty
            }))
          if (showBody) {
            if (!compareNames(self.name, nme.WILDCARD)) {
              print(" { ", self.name);
              printOpt(": ", self.tpt);
              print(" =>")
            } else if (!self.tpt.isEmpty) {
              print(" { _ : ", self.tpt, " =>")
            } else {
              print(" {")
            }
            contextManaged(tree) {
              printColumn(modBody, "", "", "}")
            }
          }

        case Block(stats, expr) =>
          contextManaged(tree){
            printColumn(stats ::: List(expr), "{", ";", "}")
          }

        case Match(selector, cases) =>
          //insert braces if match is inner
          //make this function available for other casses
          //passing required type for checking
          def insertBraces(body: =>Unit) {
            if (contextStack.exists{
              _.isInstanceOf[Match]
            }) {
              print("(")
              body
              print(")")
            } else body
          }

          val printParantheses = specialTreeContext(selector)(iLabelDef = false)
          tree match {
            case Match(EmptyTree, cs) =>
              printColumn(cases, "{", "", "}")
            case _ =>
              insertBraces {
                contextManaged(tree){
                  codeInParantheses(printParantheses) {
                    print(selector);
                  }
                }
                printColumn(cases, " match {", "", "}")
              }
          }

        case CaseDef(pat, guard, body) =>
          print("case ")
          def patConstr(pat: Tree): Tree = pat match {
            case Apply(fn, args) => patConstr(fn)
            case _ => pat
          }
          print(pat);
          printOpt(" if ", guard)
          contextManaged(tree) {
            print(" => ", body)
          }

        case Star(elem) =>
          print(elem, "*")

        case Bind(name, t) =>
          if (t == EmptyTree) print("(", symbName(tree, name), ")")
          else if (t.exists{
            case _:Star => true
            case _ => false
          }) print(symbName(tree, name), " @ ", t)
          else print("(", symbName(tree, name), " @ ", t, ")")

        //almost the same as in original
        case Function(vparams, body) =>
          print("(");
          printValueParams(vparams, true);
          print(" => ", body, ")")

        case Typed(expr, tp) =>
          tp match {
            case Function(List(), EmptyTree) => print("(", expr, " _)") //func _
            case _ => print("((", expr, "): ", tp, ")") //parenteses required when (a match {}) : Type
          }

        case Apply(fun, vargs) =>
          tree match {
//            case Apply(x, List(Ident(name))) if name.toString == "<unapply-selector>" =>
//              val res = x.find{
//                case Select(q, _:Name) => true
//                case _ => false
//              }
//              if (res.isDefined) print(res.get.asInstanceOf[Select].qualifier)
            //TODO change for ch search (when there are several TypeApply)
            case Apply(ta @ TypeApply(ch @ Select(res, _),_), List(Ident(name))) if name.toString() == "<unapply-selector>" => print(res)
            case _ => super.printTree(tree)
          }

        //TODO try to change it on previous printer
        case Super(This(qual), mix) =>
          print("super")

        case This(qual) =>
          //symName is redefined

          if (!qual.isEmpty)
            print(symbName(tree, qual) + ".")
          print("this")

        case Select(qual@New(tpe), name) =>
          print(qual)

        case Select(t@This(name), res) =>
          super.printTree(mkThis(tree))

        case s@Select(qualifier, name) => {
          val printParantheses = specialTreeContext(qualifier)(iAnnotated = false) || isIntLitWithDecodedOp(qualifier, name)
          if (printParantheses) print("(", backquotedPath(qualifier), ").", symbName(tree, name))
          else print(backquotedPath(qualifier), ".", symbName(tree, name))
        }

        case l@Literal(x) =>
          if (x.value.isInstanceOf[String] && printMultiline && x.stringValue.contains("\n") && !x.stringValue.contains("\"\"\"") && x.stringValue.size > 1) {
            super.printTree(l)
          } else {
            //processing Float constants
            val printValue = x.escapedStringValue + (if (x.value.isInstanceOf[Float]) "F" else "") //correct printing of Float
            print(printValue.trim)
          }

        case UnApply(fun, args) =>
          print(fun); printRow(args, "(", ", ", ")")

        case ta @ TypeApply(fun, targs) =>
          print(fun); printRow(targs, "[", ", ", "]")

        case CompoundTypeTree(templ) =>
          contextManaged(tree){
            print(templ)
          }

        case tt:TypTree =>
          print(tt.tpe.toString())

        case emptyTree if emptyTree.toString == "<empty>" => // workaround as case EmptyTree does not work for all universes because of path depedent types

        case tree => super.printTree(tree)
      }
    }
    def returnIfCond(cond: Boolean)(printVal: String) = if (cond) printVal else ""

    def isTreePrintable(tree: Tree) = tree match {
      case tt: TypeTree => Option(tt.original).isEmpty
      case _ => false
    }

    override def backquotedPath(t: Tree): String = {
      t match {
        case Select(This(name), res: Name) if (!name.isEmpty) =>
          super.backquotedPath(mkThis(t))
        case _ => super.backquotedPath(t)
      }
    }

    override def removeDefaultClassesFromList(trees: List[Tree], classesToRemove: List[String]) = trees filter {
      case t:TypeTree => !((classesToRemove.contains(t.toString)))
      case Select(Ident(sc), name) => !((classesToRemove.contains(name.toString)) && (sc.toString == "scala"))
      case _ => false
    }

    override def removeDefaultTraitsFromList(trees: List[Tree], traitsToRemove: List[String]): List[Tree] =
      trees match {
        case Nil => trees
        case list : List[Tree] => list.last match {
          case t:TypeTree if ((traitsToRemove.contains(t.toString)))
          => removeDefaultTraitsFromList(list.init, traitsToRemove)
          case _ => super.removeDefaultTraitsFromList(trees, traitsToRemove)
        }
      }

    def mkThis(tree: Tree) = tree match {
        case Select(th @ This(name), res) if (classContext.getOrElse(NoSymbol) == th.symbol) && !name.isEmpty =>
          def selectThisTree(name: String) = Select(This(newFreeTypeSymbol(newTypeName(""), origin = "")), name)
          if (compareNames(res, nme.CONSTRUCTOR)) Ident(res) else selectThisTree(res.decode).setSymbol(tree.symbol) //TODO fix for encoded names
        case Select(th @ This(_), res) if (th.symbol.isPackage) =>
          Ident(res)
        case _ =>
          tree
    }
  }
}


text:
export JASMINE_CLIENT_UNIT=0
export JASMINE_SERVER_UNIT=0

export JASMINE_CLIENT_INTEGRATION=1
export JASMINE_SERVER_INTEGRATION=1
export CUCUMBER=1

if [ $1 = "--test" ]; then
  export CUCUMBER_TAIL=1;
  #export SIMIAN_ACCESS_TOKEN=
fi

meteor $1 --settings settings.json --release velocity:METEOR@1.1.0.2_3 --raw-logs


text:
<resources>

    <string name="title_activity_main">Conjugator</string>

</resources>