text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FTPServer;

/**
 *
 * @author Inbo
 */
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

public class FTPServer {

    DataInputStream din;
    DataOutputStream dout;
    Socket ClientSoc;
    boolean allow = false;
    String ipaddress = "";

    public FTPServer() throws Exception {
        try {
            ServerSocket soc = new ServerSocket(5217);
            System.out.println("FTP Server Started on Port Number 5217");
            ClientSoc = soc.accept();
            ipaddress = ClientSoc.getRemoteSocketAddress().toString();

            if (ipaddress.contains(":")) {
                ipaddress = ipaddress.substring(1, ipaddress.indexOf(":"));
            }
            din = new DataInputStream(ClientSoc.getInputStream());
            dout = new DataOutputStream(ClientSoc.getOutputStream());
            //while (true) {
            VerifyClient();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void VerifyClient() {
        try {

            String Path=new File(".").getCanonicalPath()+"\\src\\IDSRule\\IDSAllow.txt";
            //FileInputStream fis = new FileInputStream("C:\\Azaz\\GAIDS\\build\\classes\\IDSRule\\IDSAllow.txt");

            FileInputStream fis = new FileInputStream(Path);
            BufferedReader br = new BufferedReader(new InputStreamReader(fis));
            String text = "";
            StringBuffer content = new StringBuffer();
            ArrayList IPAddr = new ArrayList();
            while ((text = br.readLine()) != null) {
                if (text.contains("Allow IP Address")) {
                    content.append(text);

                    //getting blocked IP from list
                    String ip = text.substring(text.indexOf("{") + 1, text.lastIndexOf("}"));
                    StringTokenizer st = new StringTokenizer(ip, ",");
                    while (st.hasMoreElements()) {
                        IPAddr.add(st.nextToken());
                    }
                    System.err.println(IPAddr);
                    System.err.println("Client Ip==== " + ipaddress);
                }
            }

            for (int i = 0; i < IPAddr.size(); i++) {
                if (IPAddr.get(i).toString().equals(ipaddress)) {
                    allow = true;
                }
            }

            Runtime r = Runtime.getRuntime();
            if (allow) {

                dout.writeUTF("Yes");
                dout.flush();

                //Process pr = r.exec(" C:\\Program Files\\glassfish-3.1\\glassfish\\bin\\startserv.bat");
                Process pr = r.exec(" C:\\apache-tomcat-7.0.29\\bin\\startup.bat");

                File f = new File("C:\\ReceivedFromClient.txt");

                FileOutputStream fout = new FileOutputStream(f);
                int ch;
                String temp;
                do {
                    temp = din.readUTF();
                    ch = Integer.parseInt(temp);
                    System.out.println(ch);
                    if (ch != -1) {
                        fout.write(ch);
                    }
                } while (ch != -1);
                fout.close();
                JOptionPane.showMessageDialog(null, "File Receved From " + ipaddress);
            } else {
                //Process pr = r.exec(" C:\\Program Files\\glassfish-3.1\\glassfish\\bin\\stopserv.bat");
                Process pr = r.exec(" C:\\apache-tomcat-7.0.29\\bin\\shutdown.bat");
                //C:\apache-tomcat-7.0.29\bin
                dout.writeUTF("No");
                dout.flush();
                System.err.println("false==written to socket");
            }

        } catch (Exception ex) {
            Logger.getLogger(FTPServer.class.getName()).log(Level.SEVERE, null, ex);
        }
        //return allow;
    }

    public static void main(String args[]) throws Exception {
    }
}


text:
Blog-files
==========

All the documents I use/link to ly blog posts

redpajama_set_name: RedPajamaGithub


text:
import document_reference from 'ember-fhir-adapter/models/document-reference';
export default document_reference;


text:
#pragma once
#ifndef OGLPLUS_BUFFER_MAP_1107121519_HPP
#define OGLPLUS_BUFFER_MAP_1107121519_HPP

#include <oglplus/config.hpp>
#include <oglplus/fwd.hpp>
#include <oglplus/glfunc.hpp>
#include <oglplus/error.hpp>
#include <oglplus/buffer_map_access.hpp>
#include <oglplus/buffer_target.hpp>

namespace oglplus {

#if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
/// Untyped mapping of the buffer to the client address space
class BufferRawMap
{
private:
	const GLintptr _offset;
	GLsizeiptr _size;
	GLvoid* _ptr;
	const BufferTarget _target;

	static GLsizeiptr _get_size(BufferTarget target)
	{
		GLint value = 0;
		OGLPLUS_GLFUNC(GetBufferParameteriv)(
			GLenum(target),
			GL_BUFFER_SIZE,
			&value
		);
		OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(GetBufferParameteriv));
		return GLsizeiptr(value);
	}

	static GLenum _translate(GLbitfield access)
	{
		switch(access)
		{
			case GL_MAP_READ_BIT:
				return GL_READ_ONLY;
			case GL_MAP_WRITE_BIT:
				return GL_WRITE_ONLY;
			case GL_MAP_READ_BIT|GL_MAP_WRITE_BIT:
				return GL_READ_WRITE;
		}
		return GL_READ_ONLY;
	}
public:
	/// Maps a range of the buffer
	/**
	 *  @param target use the buffer bound to the specified target
	 *  @param byte_offset map offset in machine bytes
	 *  @param size_bytes map size in machine bytes
	 *  @param access the access specifier for the buffer mapping
	 *
	 *  @glsymbols
	 *  @glfunref{MapBufferRange}
	 *
	 *  @throws Error
	 */
	BufferRawMap(
		BufferTarget target,
		GLintptr byte_offset,
		GLsizeiptr size_bytes,
		Bitfield<BufferMapAccess> access
	): _offset(byte_offset)
	 , _size(size_bytes)
	 , _ptr(
		OGLPLUS_GLFUNC(MapBufferRange)(
			GLenum(target),
			byte_offset,
			size_bytes,
			GLbitfield(access)
		)
	), _target(target)
	{
		OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(MapBufferRange));
	}

	/// Maps the whole buffer
	/**
	 *  @param target use the buffer bound to the target specified
	 *  @param access the access specifier for the buffer mapping
	 *
	 * This class is non-copyable.
	 *
	 *  @glsymbols
	 *  @glfunref{MapBuffer}
	 *
	 *  @throws Error
	 */
	BufferRawMap(BufferTarget target, Bitfield<BufferMapAccess> access)
	 : _offset(0)
	 , _size(_get_size(target))
	 , _ptr(
		OGLPLUS_GLFUNC(MapBuffer)(
			GLenum(target),
			_translate(GLbitfield(access))
		)
	), _target(target)
	{
		OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(MapBuffer));
	}

#if !OGLPLUS_NO_DELETED_FUNCTIONS
	BufferRawMap(const BufferRawMap&) = delete;
#else
private:
	BufferRawMap(const BufferRawMap&);
public:
#endif
	/// Move construction is enabled
	BufferRawMap(BufferRawMap&& temp)
	 : _offset(temp._offset)
	 , _size(temp._size)
	 , _ptr(temp._ptr)
	 , _target(temp._target)
	{
		temp._ptr = nullptr;
	}

	/// Unmaps the buffer from client address space (if mapped)
	~BufferRawMap(void)
	{
		try { Unmap(); }
		catch(...){ }
	}

	/// Unmaps the buffer from client address space
	/**
	 *  @glsymbols
	 *  @glfunref{UnmapBuffer}
	 *
	 *  @throws Error
	 */
	void Unmap(void)
	{
		if(_ptr != nullptr)
		{
			OGLPLUS_GLFUNC(UnmapBuffer)(GLenum(_target));
			OGLPLUS_VERIFY(OGLPLUS_ERROR_INFO(UnmapBuffer));
			_ptr = nullptr;
		}
	}

	/// Returns true if the buffer is mapped
	bool Mapped(void) const
	{
		return _ptr != nullptr;
	}

	/// Returns the size (in bytes) of the mapped buffer
	GLsizeiptr Size(void) const
	{
		return _size;
	}

	/// Returns a const pointer to the mapped data
	/**
	 *  @pre Mapped()
	 */
	const GLvoid* RawData(void) const
	{
		assert(Mapped());
		return _ptr;
	}

	/// Returns a pointer to the mapped data
	/**
	 *  @pre Mapped()
	 */
	GLvoid* RawData(void)
	{
		assert(Mapped());
		return _ptr;
	}

	/// Indicate modifications to a mapped range
	/**
	 *  @glsymbols
	 *  @glfunref{FlushMappedBufferRange}
	 *
	 *  @pre Mapped()
	 *
	 *  @throws Error
	 */
	void FlushRange(GLintptr offset, GLsizeiptr length)
	{
		OGLPLUS_GLFUNC(FlushMappedBufferRange)(
			GLenum(_target),
			offset,
			length
		);
		OGLPLUS_CHECK(OGLPLUS_ERROR_INFO(FlushMappedBufferRange));
	}
};

/// Typed mapping of the buffer to the client address space
template <typename Type>
class BufferTypedMap
 : public BufferRawMap
{
public:
	/// Maps a range of the buffer
	/**
	 *  @param target use the buffer bound to the target specified
	 *  @param offset map offset in units of Type
	 *  @param size map size in units of Type
	 *  @param access the access specifier for the buffer mapping
	 *
	 *  @throws Error
	 */
	BufferTypedMap(
		BufferTarget target,
		GLintptr offset,
		GLsizeiptr size,
		Bitfield<BufferMapAccess> access
	): BufferRawMap(
		target,
		offset * sizeof(Type),
	 	size * sizeof(Type),
		access
	){ }

	/// Maps the whole buffer
	/**
	 *  @param target use the buffer bound to the target specified
	 *  @param access the access specifier for the buffer mapping
	 *
	 * This class is non-copyable.
	 *
	 *  @throws Error
	 */
	BufferTypedMap(BufferTarget target, Bitfield<BufferMapAccess> access)
	 : BufferRawMap(target, access)
	{ }

	/// Move construction is enabled
	BufferTypedMap(BufferTypedMap&& temp)
	 : BufferRawMap(static_cast<BufferRawMap&&>(temp))
	{ }

	/// Returns the count of elements of Type in the mapped buffer
	GLsizeiptr Count(void) const
	{
		assert(this->Size() % sizeof(Type) == 0);
		return this->Size() / sizeof(Type);
	}

	/// Returns a const pointer to the mapped data
	const Type* Data(void) const
	{
		return static_cast<const Type*>(this->RawData());
	}

	/// Returns a pointer to the mapped data
	Type* Data(void)
	{
		return static_cast<Type*>(this->RawData());
	}

	/// Returns a const reference to the element at the specified index
	const Type& At(GLuint index) const
	{
		assert(Data() != nullptr);
		assert(((index+1)*sizeof(Type)) <= std::size_t(this->Size()));
		return Data()[index];
	}

	/// Returns a reference to the element at the specified index
	Type& At(GLuint index)
	{
		assert(Data() != nullptr);
		assert(((index+1)*sizeof(Type)) <= std::size_t(this->Size()));
		return Data()[index];
	}

	/// Indicate modifications to a mapped range of elements of Type
	/**
	 *  @param start Index of the first element.
	 *  @param count The number of elements to be flushed.
	 *
	 *  @glsymbols
	 *  @glfunref{FlushMappedBufferRange}
	 *
	 *  @pre this->Mapped()
	 *
	 *  @throws Error
	 */
	void FlushElements(unsigned start, unsigned count)
	{
		this->FlushRange(sizeof(Type)*start, sizeof(Type)*count);
	}
};
#endif // GL_VERSION_3_0

} // namespace oglplus

#endif // include guard


text:
package org.apache.james.protocols.lmtp;

import org.apache.james.protocols.api.ProtocolConfigurationImpl;
import org.apache.james.protocols.smtp.SMTPConfiguration;

public abstract class LMTPConfiguration extends ProtocolConfigurationImpl implements SMTPConfiguration{

    public LMTPConfiguration() {
        setSoftwareName("JAMES Protocols LMTP Server");
    }
    /*
     * (non-Javadoc)
     * @see org.apache.james.protocols.smtp.SMTPConfiguration#isRelayingAllowed(java.lang.String)
     */
    public boolean isRelayingAllowed(String remoteIP) {
        return false;
    }

    /*
     * (non-Javadoc)
     * @see org.apache.james.protocols.smtp.SMTPConfiguration#isAuthRequired(java.lang.String)
     */
    public boolean isAuthRequired(String remoteIP) {
        return false;
    }

    /*
     * (non-Javadoc)
     * @see org.apache.james.protocols.smtp.SMTPConfiguration#useHeloEhloEnforcement()
     */
    public boolean useHeloEhloEnforcement() {
        return false;
    }

    /*
     * (non-Javadoc)
     * @see org.apache.james.protocols.smtp.SMTPConfiguration#useAddressBracketsEnforcement()
     */
    public boolean useAddressBracketsEnforcement() {
        return false;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MonoCross.Navigation;
using MonoCross.Console;

namespace $safeprojectname$
{
    public class Program
    {
        static void Main(string[] args)
        {
            // initialize container
            // example: MXConsoleContainer.Initialize(new HelloWorld.App());

            // initialize views
            MXConsoleContainer.AddView<string>(new Views.MessageView(), ViewPerspective.Default);

            // navigate to first view
            MXConsoleContainer.Navigate(MXContainer.Instance.App.NavigateOnLoad);
        }
    }
}


text:
<?xml version='1.0' encoding='UTF-8'?>
<matrix-project plugin="matrix-project@1.11">
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.5.1">
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
        <url>git@github.com:bicschneider/test-git-phlow-plugin.git</url>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
        <name>*/readyMxExtFFOnly/*</name>
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions>
      <org.jenkinsci.plugins.pretestedintegration.scm.git.PretestedIntegrationAsGitPluginExt plugin="pretested-integration@3.0.0-SNAPSHOT">
        <integrationBranch>masterMxExtFFOnly</integrationBranch>
        <repoName>origin</repoName>
        <gitIntegrationStrategy class="org.jenkinsci.plugins.pretestedintegration.scm.git.AccumulatedCommitStrategy"/>
      </org.jenkinsci.plugins.pretestedintegration.scm.git.PretestedIntegrationAsGitPluginExt>
      <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/>
      <hudson.plugins.git.extensions.impl.PruneStaleBranch/>
      <hudson.plugins.git.extensions.impl.ChangelogToBranch>
        <options>
          <compareRemote>origin</compareRemote>
          <compareTarget>masterMxExtFFOnly</compareTarget>
        </options>
      </hudson.plugins.git.extensions.impl.ChangelogToBranch>
    </extensions>
  </scm>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers>
    <hudson.triggers.SCMTrigger>
      <spec>* * * * *</spec>
      <ignorePostCommitHooks>false</ignorePostCommitHooks>
    </hudson.triggers.SCMTrigger>
  </triggers>
  <concurrentBuild>false</concurrentBuild>
  <axes>
    <hudson.matrix.TextAxis>
      <name>test</name>
      <values>
        <string>a</string>
        <string>b</string>
      </values>
    </hudson.matrix.TextAxis>
  </axes>
  <builders>
    <hudson.tasks.Shell>
      <command>git log --graph --oneline --decorate -10

</command>
    </hudson.tasks.Shell>
    <org.jenkinsci.plugins.conditionalbuildstep.ConditionalBuilder plugin="conditional-buildstep@1.3.6">
      <runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail" plugin="run-condition@1.0"/>
      <runCondition class="org.jenkins_ci.plugins.run_condition.core.StatusCondition" plugin="run-condition@1.0">
        <worstResult>
          <name>SUCCESS</name>
          <ordinal>0</ordinal>
          <color>BLUE</color>
          <completeBuild>true</completeBuild>
        </worstResult>
        <bestResult>
          <name>SUCCESS</name>
          <ordinal>0</ordinal>
          <color>BLUE</color>
          <completeBuild>true</completeBuild>
        </bestResult>
      </runCondition>
      <conditionalbuilders>
        <hudson.tasks.Shell>
          <command>if [ -e build_failed.md ] ; then
  echo "BUILD FAILED"
fi</command>
        </hudson.tasks.Shell>
      </conditionalbuilders>
    </org.jenkinsci.plugins.conditionalbuildstep.ConditionalBuilder>
  </builders>
  <publishers>
    <org.jenkinsci.plugins.pretestedintegration.PretestedIntegrationPostCheckout plugin="pretested-integration@3.0.0-SNAPSHOT"/>
  </publishers>
  <buildWrappers/>
  <executionStrategy class="hudson.matrix.DefaultMatrixExecutionStrategyImpl">
    <runSequentially>false</runSequentially>
  </executionStrategy>
</matrix-project>


text:
function rpc(ohc, ip_addr, port)
{
	this.ohc = ohc;
	this.lport = port;
	this.ip_addr = ip_addr;
	this.no_auth_methods = new Array();
	this.no_auth_methods.push(this.get_ip);
	this.no_auth_methods.push(this.login);
}

rpc.prototype.get_ip = function(json)
{
	var resp = new Object();
	resp.method = 'set_ip_address';
	resp.ip_address = this.ip_addr;
	resp.port = this.lport;
	resp.success = true;
	return resp;
}

rpc.prototype.login = function(json)
{
	var resp = new Object();
	resp.success = false;
	var uname = json.uname;
	var passwd = json.passwd;
	if(typeof uname != 'string' || typeof passwd != 'string')
		return resp;
	var resp = new Object();
	var token = this.ohc.login(uname, passwd);
	resp.method = 'set_session_token';
	resp.session_token = token;
	resp.success = token.length > 0;
	return resp;
}

rpc.prototype.get_num_devices = function(json)
{
	var resp = new Object();
	resp.success = true;
	resp.method = 'set_num_devices';
	resp.num_devices = this.ohc.num_devices;
	return resp;
}

rpc.prototype.get_device_id = function(json)
{
	var resp = new Object();
	resp.success = false;
	if(typeof json.index !== 'number')
		return resp;
	resp.index = json.index;
	resp.method = 'set_device_id';
	resp.id = this.ohc.get_device_id(json.index);
	resp.success = true;
	return resp;
}

rpc.prototype.device_get_num_fields = function(json)
{
	var resp = new Object();
	resp.method = 'device_set_num_fields';
	resp.sucess = false;
	if(typeof json.id !== 'string')
		return resp;
	resp.id = json.id;
	if(typeof this.ohc.devices[json.id] == 'undefined')
		return resp;
	resp.num_fields = this.ohc.devices[json.id].get_num_fields();
	resp.sucess = true;
	return resp;
}

rpc.prototype.get_device_name = function(json)
{
	var resp = new Object();
	resp.method = 'set_device_name';
	resp.sucess = false;
	if(typeof json.id !== 'string')
		return resp;
	resp.id = json.id;
	if(typeof this.ohc.devices[json.id] == 'undefined')
		return resp;
	resp.name = this.ohc.devices[json.id].get_name();
	resp.sucess = true;
	return resp;
}

rpc.prototype.set_device_name = function(json)
{
	var resp = new Object();
	resp.method = 'set_device_name_done';
	resp.sucess = false;
	if(typeof json.id !== 'string')
		return resp;
	resp.id = json.id;
	if(typeof this.ohc.devices[json.id] == 'undefined')
		return resp;
	if(typeof json.name !== 'string')
		return resp;
	this.ohc.devices[json.id].set_name(json.name);
	resp.sucess = true;
	return resp;
}

rpc.prototype.device_get_field = function(json)
{
	var resp = new Object();
	resp.method = 'device_set_field';
	resp.sucess = false;
	if(typeof json.device_id !== 'string')
		return resp;
	resp.device_id = json.device_id;
	if(typeof this.ohc.devices[json.device_id] == 'undefined')
		return resp;
	if(typeof json.field_id !== 'number')
		return resp;
	resp.field_id = json.field_id;
	var field = this.ohc.devices[json.device_id].get_field(json.field_id);
	if(typeof field == 'undefined')
		return resp;
	if(typeof field.readable == 'undefined' || field.readable == false)
	{
		return resp;
	}
	else
	{
		resp.field = field;
	}
	resp.sucess = true;
	return resp;
}

rpc.prototype.device_set_field_value = function(json)
{
	var resp = new Object();
	resp.method = 'device_set_field_done';
	resp.sucess = false;
	if(typeof json.value == 'undefined')
		return resp;
	if(typeof json.device_id !== 'string')
		return resp;
	resp.device_id = json.device_id;
	if(typeof this.ohc.devices[json.device_id] == 'undefined')
		return resp;
	if(typeof json.field_id !== 'number')
		return resp;
	resp.field_id = json.field_id;
	var field = this.ohc.devices[json.device_id].get_field(json.field_id);
	if(typeof field == 'undefined')
		return resp;
	if(typeof field.writable == 'undefined' || field.writable == false)
	{
		return resp;
	}
	else
	{
		resp.sucess = this.ohc.devices[json.device_id].set_field_value(json.field_id, json.value);
	}
	return resp;
}

module.exports = rpc;


text:
"""Contains helper functions and classes necessary for decoding data.

While data providers read data from disk, sstables or other formats, data
decoders decode the data (if necessary). A data decoder is provided with a
serialized or encoded piece of data as well as a list of items and
returns a set of tensors, each of which correspond to the requested list of
items extracted from the data:

  def Decode(self, data, items):
    ...

For example, if data is a compressed map, the implementation might be:

  def Decode(self, data, items):
    decompressed_map = _Decompress(data)
    outputs = []
    for item in items:
      outputs.append(decompressed_map[item])
    return outputs.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import abc

class DataDecoder(object):
  """An abstract class which is used to decode data for a provider."""

  __metaclass__ = abc.ABCMeta

  @abc.abstractmethod
  def decode(self, data, items):
    """Decodes the data to returns the tensors specified by the list of items.

    Args:
      data: A possibly encoded data format.
      items: A list of strings, each of which indicate a particular data type.

    Returns:
      A list of `Tensors`, whose length matches the length of `items`, where
      each `Tensor` corresponds to each item.

    Raises:
      ValueError: If any of the items cannot be satisfied.
    """
    pass

  @abc.abstractmethod
  def list_items(self):
    """Lists the names of the items that the decoder can decode.

    Returns:
      A list of string names.
    """
    pass


text:
package io.undertow.server.handlers.error;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import io.undertow.util.MimeMappings;
import org.jboss.logging.Logger;
import org.xnio.IoUtils;
import org.xnio.channels.Channels;
import org.xnio.channels.StreamSinkChannel;

import io.undertow.Handlers;
import io.undertow.UndertowLogger;
import io.undertow.server.DefaultResponseListener;
import io.undertow.server.ExchangeCompletionListener;
import io.undertow.server.HandlerWrapper;
import io.undertow.server.HttpHandler;
import io.undertow.server.HttpServerExchange;
import io.undertow.server.handlers.ResponseCodeHandler;
import io.undertow.server.handlers.builder.HandlerBuilder;
import io.undertow.util.Headers;

/**
 * Handler that serves up a file from disk to serve as an error page.
 * <p>
 * This handler does not server up and response codes by default, you must configure
 * the response codes it responds to.
 *
 * @author Stuart Douglas
 */
public class FileErrorPageHandler implements HttpHandler {

    private static final Logger log = Logger.getLogger("io.undertow.server.error.file");
    private volatile HttpHandler next = ResponseCodeHandler.HANDLE_404;

    /**
     * The response codes that this handler will handle. If this is empty then this handler will have no effect.
     */
    private volatile Set<Integer> responseCodes;

    private volatile Path file;

    private final MimeMappings mimeMappings;

    @Deprecated
    public FileErrorPageHandler(final File file, final Integer... responseCodes) {
        this(file.toPath(), responseCodes);
    }

    public FileErrorPageHandler(final Path file, final Integer... responseCodes) {
        this.file = file;
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
        this.mimeMappings = MimeMappings.DEFAULT;
    }

    @Deprecated
    public FileErrorPageHandler(HttpHandler next, final File file, final Integer... responseCodes) {
        this(next, file.toPath(), responseCodes);
    }

    public FileErrorPageHandler(HttpHandler next, final Path file, final Integer... responseCodes) {
        this(next, file, MimeMappings.DEFAULT, responseCodes);
    }

    public FileErrorPageHandler(HttpHandler next, final Path file, MimeMappings mimeMappings, final Integer... responseCodes) {
        this.next = next;
        this.file = file;
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
        this.mimeMappings = mimeMappings;
    }

    @Override
    public void handleRequest(final HttpServerExchange exchange) throws Exception {
        exchange.addDefaultResponseListener(new DefaultResponseListener() {
            @Override
            public boolean handleDefaultResponse(final HttpServerExchange exchange) {
                Set<Integer> codes = responseCodes;
                if (!exchange.isResponseStarted() && codes.contains(exchange.getStatusCode())) {
                    serveFile(exchange);
                    return true;
                }
                return false;
            }
        });

        next.handleRequest(exchange);
    }

    private void serveFile(final HttpServerExchange exchange) {
        String fileName = file.toString();
        int index = fileName.lastIndexOf(".");
        if(index > 0) {
            String contentType = mimeMappings.getMimeType(fileName.substring(index + 1));
            if(contentType != null) {
                exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, contentType);
            }
        }
        exchange.dispatch(new Runnable() {
            @Override
            public void run() {
                final FileChannel fileChannel;
                try {
                    try {
                        fileChannel = FileChannel.open(file, StandardOpenOption.READ);
                    } catch (FileNotFoundException e) {
                        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                        exchange.endExchange();
                        return;
                    }
                } catch (IOException e) {
                    UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                    exchange.endExchange();
                    return;
                }
                long size;
                try {
                    size = Files.size(file);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                exchange.getResponseHeaders().put(Headers.CONTENT_LENGTH, size);
                final StreamSinkChannel response = exchange.getResponseChannel();
                exchange.addExchangeCompleteListener(new ExchangeCompletionListener() {
                    @Override
                    public void exchangeEvent(HttpServerExchange exchange, NextListener nextListener) {
                        IoUtils.safeClose(fileChannel);
                        nextListener.proceed();
                    }
                });

                try {
                    log.tracef("Serving file %s (blocking)", fileChannel);
                    Channels.transferBlocking(response, fileChannel, 0, Files.size(file));
                    log.tracef("Finished serving %s, shutting down (blocking)", fileChannel);
                    response.shutdownWrites();
                    log.tracef("Finished serving %s, flushing (blocking)", fileChannel);
                    Channels.flushBlocking(response);
                    log.tracef("Finished serving %s (complete)", fileChannel);
                    exchange.endExchange();
                } catch (IOException ignored) {
                    log.tracef("Failed to serve %s: %s", fileChannel, ignored);
                    exchange.endExchange();
                    IoUtils.safeClose(response);
                } finally {
                    IoUtils.safeClose(fileChannel);
                }
            }
        });
    }

    public HttpHandler getNext() {
        return next;
    }

    public FileErrorPageHandler setNext(final HttpHandler next) {
        Handlers.handlerNotNull(next);
        this.next = next;
        return this;
    }

    public Set<Integer> getResponseCodes() {
        return Collections.unmodifiableSet(responseCodes);
    }

    public FileErrorPageHandler setResponseCodes(final Set<Integer> responseCodes) {
        if (responseCodes == null) {
            this.responseCodes = Collections.emptySet();
        } else {
            this.responseCodes = new HashSet<>(responseCodes);
        }
        return this;
    }

    public FileErrorPageHandler setResponseCodes(final Integer... responseCodes) {
        this.responseCodes = new HashSet<>(Arrays.asList(responseCodes));
        return this;
    }

    public Path getFile() {
        return file;
    }

    public FileErrorPageHandler setFile(final Path file) {
        this.file = file;
        return this;
    }

    @Override
    public String toString() {
        return "response-codes( file='" + file.toString() + "', response-codes={ " + responseCodes.stream().map(s -> s.toString()).collect(Collectors.joining(", ")) + " } )";
    }

    public static class Builder implements HandlerBuilder {

        @Override
        public String name() {
            return "error-file";
        }

        @Override
        public Map<String, Class<?>> parameters() {
            Map<String, Class<?>> params = new HashMap<>();
            params.put("file", String.class);
            params.put("response-codes", Integer[].class);
            return params;
        }

        @Override
        public Set<String> requiredParameters() {
            return new HashSet<>(Arrays.asList(new String[]{"file", "response-codes"}));
        }

        @Override
        public String defaultParameter() {
            return null;
        }

        @Override
        public HandlerWrapper build(Map<String, Object> config) {
            return new Wrapper((String)config.get("file"), (Integer[]) config.get("response-codes"));
        }

    }

    private static class Wrapper implements HandlerWrapper {

        private final String file;
        private final Integer[] responseCodes;

        private Wrapper(String file, Integer[] responseCodes) {
            this.file = file;
            this.responseCodes = responseCodes;
        }

        @Override
        public HttpHandler wrap(HttpHandler handler) {
            return new FileErrorPageHandler(handler, Paths.get(file), responseCodes);
        }
    }
}


text:
// Copyright 2016 The Bazel Authors. All rights reserved.
//
// 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
//
//    http://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.
package com.google.devtools.build.android.desugar.io;

/** Class loader that throws whenever it can, for use the parent of a class loader hierarchy. */
public class ThrowingClassLoader extends ClassLoader {
  @Override
  protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
    if (name.startsWith("java.")) {
      // Use system class loader for java. classes, since ClassLoader.defineClass gets
      // grumpy when those don't come from the standard place.
      return super.loadClass(name, resolve);
    }
    throw new ClassNotFoundException();
  }
}


text:
package com.loqate.justincano.phonebook;

import java.io.*;
import java.util.*;
import java.net.*;

public class Main {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		PhoneBook pb = new PhoneBook();

	    Scanner scanner = new Scanner( System.in );

	    System.out.println( "Insert Phone Book entry" );

	    System.out.print( "First Name: " );
	    String fname = scanner.nextLine();

	    System.out.print( "Last Name: " );
	    String lname = scanner.nextLine();

	    System.out.print( "Address: " );
	    String address = scanner.nextLine();

	    System.out.print( "Phone Number: " );
	    String phone = scanner.nextLine();

		pb.insert(fname, lname, address, phone);

		pb.print();
	}
}


text:
package com.sun.codemodel;

/**
 * JThrow statement
 */

class JThrow implements JStatement {

    /**
     * JExpression to throw
     */
    private JExpression expr;

    /**
     * JThrow constructor
     *
     * @param expr
     *        JExpression which evaluates to JThrow value
     */
    JThrow(JExpression expr) {
       this.expr = expr;
    }

    @Override
    public void state(JFormatter f) {
        f.p("throw");
        f.g(expr);
        f.p(';').nl();
    }

}


text:
package org.springframework.content.rest.boot;

import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.AfterEach;
import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.BeforeEach;
import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.Context;
import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.Describe;
import static com.github.paulcwarren.ginkgo4j.Ginkgo4jDSL.It;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

import java.net.URI;

import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.AutoConfigurationPackage;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.content.commons.annotations.Content;
import org.springframework.content.commons.annotations.ContentId;
import org.springframework.content.commons.repository.ContentStore;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

import com.github.paulcwarren.ginkgo4j.Ginkgo4jConfiguration;
import com.github.paulcwarren.ginkgo4j.Ginkgo4jRunner;

import internal.org.springframework.content.rest.boot.autoconfigure.ContentRestAutoConfiguration;
import internal.org.springframework.content.rest.boot.autoconfigure.SpringBootContentRestConfigurer;
import internal.org.springframework.content.s3.boot.autoconfigure.S3ContentAutoConfiguration;

@RunWith(Ginkgo4jRunner.class)
@Ginkgo4jConfiguration(threads = 1)
public class ContentRestAutoConfigurationTest {

	{
		Describe("ContentRestAutoConfiguration", () -> {
			Context("given a default configuration", () -> {
				It("should load the context", () -> {
					AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
					context.register(TestConfig.class);
					context.setServletContext(new MockServletContext());
					context.refresh();

					assertThat(context.getBean("contentHandlerMapping"), is(not(nullValue())));
					assertThat(context.getBean("contentLinksProcessor"), is(not(nullValue())));

					context.close();
				});
			});

			Context("given an environment specifying rest properties", () -> {
				BeforeEach(() -> {
					System.setProperty("spring.content.rest.base-uri", "/contentApi");
					System.setProperty("spring.content.rest.fully-qualified-links", "false");
                    System.setProperty("spring.content.rest.shortcut-request-mappings.disabled", "true");
					System.setProperty("spring.content.rest.shortcut-request-mappings.excludes", "GET=a/b,c/d:PUT=*/*");
				});
				AfterEach(() -> {
					System.clearProperty("spring.content.rest.base-uri");
                    System.clearProperty("spring.content.rest.fully-qualified-links");
                    System.clearProperty("spring.content.rest.shortcut-request-mappings.disabled");
                    System.clearProperty("spring.content.rest.shortcut-request-mappings.excludes");
				});
				It("should have a filesystem properties bean with the correct properties set", () -> {
					AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
					context.register(TestConfig.class);
					context.setServletContext(new MockServletContext());
					context.refresh();

					assertThat(context.getBean(ContentRestAutoConfiguration.ContentRestProperties.class).getBaseUri(), is(URI.create("/contentApi")));
					assertThat(context.getBean(ContentRestAutoConfiguration.ContentRestProperties.class).fullyQualifiedLinks(), is(false));
                    assertThat(context.getBean(ContentRestAutoConfiguration.ContentRestProperties.class).shortcutRequestMappings().disabled(), is(true));
                    assertThat(context.getBean(ContentRestAutoConfiguration.ContentRestProperties.class).shortcutRequestMappings().excludes(), is("GET=a/b,c/d:PUT=*/*"));

					assertThat(context.getBean(SpringBootContentRestConfigurer.class), is(not(nullValue())));

					context.close();
				});
			});
		});
	}

	@Configuration
	@AutoConfigurationPackage
	@EnableAutoConfiguration(exclude = S3ContentAutoConfiguration.class)
	public static class TestConfig {
	}

	@Document
	@Content
	public class TestEntity {
		@Id
		private String id;
		@ContentId
		private String contentId;
	}

	public interface TestEntityRepository extends MongoRepository<TestEntity, String> {
	}

	public interface TestEntityContentRepository extends ContentStore<TestEntity, String> {
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<string name="missing_input">%s cannot be empty</string>
	<string name="first_name">First Name</string>
	<string name="last_name">Last Name</string>
	<string name="organization">Organization</string>
	<string name="purpose">Purpose</string>
	<string name="code">Code</string>
	<string name="name">Name</string>
	<string name="create_at">Created at</string>
	<string name="start_at">Start at</string>
	<string name="end_at">End at</string>
	<string name="host">Host</string>
	<string name="contact">Contact</string>
	<string name="note">Note</string>
	<string name="error">Error</string>
	<string name="not_exist">%s not exists</string>
	<string name="visitor">Visitor</string>
	<string name="passcode">Passcode</string>
	<string name="password">Password</string>
	<string name="title">Title</string>
	<string name="visitor_type">Visitor Type</string>
	<string name="proof_of_id">Proof of ID</string>
	<string name="event_id">Event Name</string>
	<string name="surname">Surname</string>
	<string name="email">Email</string>
	<string name="company">Company</string>
	<string name="intended_usage">Intended Usage</string>
	<string name="add_new">Add New %s</string>
	<string name="invalid">Invalid %s</string>
	<string name="mandatory">Mandatory</string>
	<string name="optional">Optional</string>
	<string name="warning">Warning</string>
	<string name="ok">Ok</string>
	<string name="try_again">Try Again</string>
	<string name="sign_in_at">Sign In at</string>
	<string name="sign_out_at">Sign Out at</string>
	<string name="day_from">Day From</string>
	<string name="day_to">Day To</string>
	<string name="no_result_found">No result found</string>
	<string name="no_network">Network connection lost, please try again later</string>
</resources>


text: <?php get_template_part('templates/content', 'featured-image'); ?>


text:
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc.  All rights reserved.
// http://github.com/jskeet/dotnet-protobufs/
// Original C++/Java/Python code:
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#endregion

using System;
using System.IO;
using Google.ProtocolBuffers.TestProtos;
using NUnit.Framework;

namespace Google.ProtocolBuffers
{
    public class AbstractMessageLiteTest
    {
        [Test]
        public void TestMessageLiteToByteString()
        {
            TestRequiredLite msg = TestRequiredLite.CreateBuilder()
                .SetD(42)
                .SetEn(ExtraEnum.EXLITE_BAZ)
                .Build();

            ByteString b = msg.ToByteString();
            Assert.AreEqual(4, b.Length);
            Assert.AreEqual(TestRequiredLite.DFieldNumber << 3, b[0]);
            Assert.AreEqual(42, b[1]);
            Assert.AreEqual(TestRequiredLite.EnFieldNumber << 3, b[2]);
            Assert.AreEqual((int) ExtraEnum.EXLITE_BAZ, b[3]);
        }

        [Test]
        public void TestMessageLiteToByteArray()
        {
            TestRequiredLite msg = TestRequiredLite.CreateBuilder()
                .SetD(42)
                .SetEn(ExtraEnum.EXLITE_BAZ)
                .Build();

            ByteString b = msg.ToByteString();
            ByteString copy = ByteString.CopyFrom(msg.ToByteArray());
            Assert.AreEqual(b, copy);
        }

        [Test]
        public void TestMessageLiteWriteTo()
        {
            TestRequiredLite msg = TestRequiredLite.CreateBuilder()
                .SetD(42)
                .SetEn(ExtraEnum.EXLITE_BAZ)
                .Build();

            MemoryStream ms = new MemoryStream();
            msg.WriteTo(ms);
            Assert.AreEqual(msg.ToByteArray(), ms.ToArray());
        }

        [Test]
        public void TestMessageLiteWriteDelimitedTo()
        {
            TestRequiredLite msg = TestRequiredLite.CreateBuilder()
                .SetD(42)
                .SetEn(ExtraEnum.EXLITE_BAZ)
                .Build();

            MemoryStream ms = new MemoryStream();
            msg.WriteDelimitedTo(ms);
            byte[] buffer = ms.ToArray();

            Assert.AreEqual(5, buffer.Length);
            Assert.AreEqual(4, buffer[0]);
            byte[] msgBytes = new byte[4];
            Array.Copy(buffer, 1, msgBytes, 0, 4);
            Assert.AreEqual(msg.ToByteArray(), msgBytes);
        }

        [Test]
        public void TestIMessageLiteWeakCreateBuilderForType()
        {
            IMessageLite msg = TestRequiredLite.DefaultInstance;
            Assert.AreEqual(typeof(TestRequiredLite.Builder), msg.WeakCreateBuilderForType().GetType());
        }

        [Test]
        public void TestMessageLiteWeakToBuilder()
        {
            IMessageLite msg = TestRequiredLite.CreateBuilder()
                .SetD(42)
                .SetEn(ExtraEnum.EXLITE_BAZ)
                .Build();

            IMessageLite copy = msg.WeakToBuilder().WeakBuild();
            Assert.AreEqual(msg.ToByteArray(), copy.ToByteArray());
        }

        [Test]
        public void TestMessageLiteWeakDefaultInstanceForType()
        {
            IMessageLite msg = TestRequiredLite.DefaultInstance;
            Assert.IsTrue(Object.ReferenceEquals(TestRequiredLite.DefaultInstance, msg.WeakDefaultInstanceForType));
        }
    }
}


text:
include(FindPackageHandleStandardArgs)

# work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html
set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)")

find_program(gcov_EXECUTABLE
    NAMES
        gcov
    PATHS
        "${GCOV_DIR}"
        "$ENV{GCOV_DIR}"
        "$ENV{PROGRAMFILES}/gcov"
        "$ENV{${PROGRAMFILES_x86_ENV}}/gcov"
)

find_package_handle_standard_args(gcov
	FOUND_VAR
        gcov_FOUND
    REQUIRED_VARS
        gcov_EXECUTABLE
)

mark_as_advanced(gcov_EXECUTABLE)


text:
/**
 * Controls: Colorpicker plugin
 *
 * Depends on jWYSIWYG, (farbtastic || other colorpicker plugins)
 */
(function ($) {
	"use strict";

	if (undefined === $.wysiwyg) {
		throw "wysiwyg.colorpicker.js depends on $.wysiwyg";
	}

	if (!$.wysiwyg.controls) {
		$.wysiwyg.controls = {};
	}

	/*
	 * Wysiwyg namespace: public properties and methods
	 */
	$.wysiwyg.controls.colorpicker = {
		modalOpen: false,
		color: {
			back: {
				prev: "#ffffff",
				palette: []
			},
			fore: {
				prev: "#123456",
				palette: []
			}
		},

		addColorToPalette: function (type, color) {
			if (-1 === $.inArray(color, this.color[type].palette)) {
				this.color[type].palette.push(color);
			} else {
				this.color[type].palette.sort(function (a, b) {
					if (a === color) {
						return 1;
					}

					return 0;
				});
			}
		},

		init: function (Wysiwyg) {
			if ($.wysiwyg.controls.colorpicker.modalOpen === true) {
				return false;
			} else {
				$.wysiwyg.controls.colorpicker.modalOpen = true;
			}
			var self = this, elements, dialog, colorpickerHtml, dialogReplacements, key, translation;

			dialogReplacements = {
				legend: "Colorpicker",
				color: "Color",
				applyForeColor: "Set Text",
				applyBgColor: "Set Background",
				reset: "Cancel"
			};

			colorpickerHtml = '<form class="wysiwyg"><fieldset><legend>{legend}</legend>' +
				'

' +
				'{color}: <input type="text" name="color" value="#123456"/>' +
				'

' +
				'<input type="button" class="button applyForeColor" value="{applyForeColor}"/> ' +
				'<input type="button" class="button applyBgColor" value="{applyBgColor}"/> ' +
				'<input type="reset" value="{reset}"/></fieldset></form>';

			for (key in dialogReplacements) {
				if ($.wysiwyg.i18n) {
					translation = $.wysiwyg.i18n.t(dialogReplacements[key], "dialogs.colorpicker");

					if (translation === dialogReplacements[key]) { // if not translated search in dialogs
						translation = $.wysiwyg.i18n.t(dialogReplacements[key], "dialogs");
					}

					dialogReplacements[key] = translation;
				}

				colorpickerHtml = colorpickerHtml.replace("{" + key + "}", dialogReplacements[key]);
			}

			if ($.modal) {
				elements = $(colorpickerHtml);

				if ($.farbtastic) {
					this.renderPalette(elements, "fore");
					elements.find(".wheel").farbtastic(elements.find("input:text"));
				}

				$.modal(elements.html(), {
					maxWidth: Wysiwyg.defaults.formWidth,
					maxHeight: Wysiwyg.defaults.formHeight,
					overlayClose: true,

					onShow: function (dialog) {
						$("input:submit", dialog.data).click(function (e) {
							var color = $('input[name="color"]', dialog.data).val();
							self.color.fore.prev = color;
							self.addColorToPalette("fore", color);

							if ($.browser.msie) {
								Wysiwyg.ui.returnRange();
							}

							Wysiwyg.editorDoc.execCommand('ForeColor', false, color);
							$.modal.close();
							return false;
						});
						$("input:reset", dialog.data).click(function (e) {
							if ($.browser.msie) {
								Wysiwyg.ui.returnRange();
							}

							$.modal.close();
							return false;
						});
						$("fieldset", dialog.data).click(function (e) {
							e.stopPropagation();
						});
					},

					onClose: function (dialog) {
						$.wysiwyg.controls.colorpicker.modalOpen = false;
						$.modal.close();
					}
				});
			} else if ($.fn.dialog) {
				elements = $(colorpickerHtml);

				if ($.farbtastic) {
					this.renderPalette(elements, "fore");
					elements.find(".wheel").farbtastic(elements.find("input:text"));
				}

				dialog = elements.appendTo("body");
				var buttonSetup = {};
				buttonSetup[ dialogReplacements['applyForeColor'] ] = function() {
					dialog.find('input.applyForeColor').click();
				};
				buttonSetup[ dialogReplacements['applyBgColor'] ] = function() {
					dialog.find('input.applyBgColor').click();
				};
				buttonSetup[ dialogReplacements['reset'] ] = function() {
					dialog.find('input:reset').click();
				};

				dialog.dialog({
					modal: true,
					open: function (event, ui) {
						$("input:button,input:reset", elements).hide();
						$("input.applyForeColor,input.applyBgColor", elements).click(function (e) {
							var color = $('input[name="color"]', dialog).val();
							self.color.fore.prev = color;
							self.addColorToPalette("fore", color);

							if ($.browser.msie) {
								Wysiwyg.ui.returnRange();
							}

							if ($(this).hasClass('applyForeColor')) {
								Wysiwyg.editorDoc.execCommand('ForeColor', false, color);
							} else {
								if ($.browser.msie)
									Wysiwyg.editorDoc.execCommand('BackColor', false, color);
								else
									Wysiwyg.editorDoc.execCommand('hilitecolor',false,color);
							}

							$(dialog).dialog("close");
							return false;
						});
						$("input:reset", elements).click(function (e) {
							if ($.browser.msie) {
								Wysiwyg.ui.returnRange();
							}

							$(dialog).dialog("close");
							return false;
						});
						$('fieldset', elements).click(function (e) {
							e.stopPropagation();
						});
					},
					buttons : buttonSetup,
					close: function (event, ui) {
						$.wysiwyg.controls.colorpicker.modalOpen = false;
						dialog.dialog("destroy");
						dialog.remove();
					}
				});
			} else {
				if ($.farbtastic) {
					elements = $("
")
						.css({"position": "fixed",
							"z-index": 2000,
							"left": "50%", "top": "50%", "background": "rgb(0, 0, 0)",
							"margin-top": -1 * Math.round(Wysiwyg.defaults.formHeight / 2),
							"margin-left": -1 * Math.round(Wysiwyg.defaults.formWidth / 2)})
						.html(colorpickerHtml);
					this.renderPalette(elements, "fore");
					elements.find("input[name=color]").val(self.color.fore.prev);
					elements.find(".wheel").farbtastic(elements.find("input:text"));
					$("input.applyForeColor,input.applyBgColor", elements).click(function (event) {
						var color = $('input[name="color"]', elements).val();
						self.color.fore.prev = color;
						self.addColorToPalette("fore", color);

						if ($.browser.msie) {
							Wysiwyg.ui.returnRange();
						}

						if ($(this).hasClass('applyForeColor')) {
							Wysiwyg.editorDoc.execCommand('ForeColor', false, color);
						} else {
							if ($.browser.msie)
								Wysiwyg.editorDoc.execCommand('BackColor', false, color);
							else
								Wysiwyg.editorDoc.execCommand('hilitecolor',false,color);
						}

						$(elements).remove();
						$.wysiwyg.controls.colorpicker.modalOpen = false;
						return false;
					});
					$("input:reset", elements).click(function (event) {

						if ($.browser.msie) {
							Wysiwyg.ui.returnRange();
						}

						$(elements).remove();
						$.wysiwyg.controls.colorpicker.modalOpen = false;
						return false;
					});
					$("body").append(elements);
					elements.click(function (e) {
						e.stopPropagation();
					});
				}
			}
		},

		renderPalette: function (jqObj, type) {
			var palette = jqObj.find(".palette"),
				bind = function () {
					var color = $(this).text();
					jqObj.find("input[name=color]").val(color);
					// farbtastic binds on keyup
					if ($.farbtastic) {
						jqObj.find("input[name=color]").trigger("keyup");
					}
				},
				colorExample,
				colorSelect,
				i;

			for (i = this.color[type].palette.length - 1; i > -1; i -= 1) {
				colorExample = $("
").css({
					"float": "left",
					"width": "16px",
					"height": "16px",
					"margin": "0px 5px 0px 0px",
					"background-color": this.color[type].palette[i]
				});

				colorSelect = $("
" + this.color[type].palette[i] + "
")
					.css({"cursor": "pointer", "list-style": "none"})
					.append(colorExample)
					.bind("click.wysiwyg", bind);

				palette.append(colorSelect).css({"margin": "0px", "padding": "0px"});
			}
		}
	};
})(jQuery);


text:
import os
import unittest

from telemetry import story
from telemetry import page as page_module
from telemetry import value
from telemetry.value import list_of_scalar_values
from telemetry.value import none_values

class StatisticComputationTest(unittest.TestCase):
  def testVariance(self):
    self.assertAlmostEqual(
        list_of_scalar_values.Variance([]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.Variance([3]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.Variance([600, 470, 170, 430, 300]), 27130)

  def testStandardDeviation(self):
    self.assertAlmostEqual(
        list_of_scalar_values.StandardDeviation([]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.StandardDeviation([1]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.StandardDeviation([600, 470, 170, 430, 300]),
        164.71186, places=4)

  def testPooledVariance(self):
    self.assertAlmostEqual(
        list_of_scalar_values.PooledStandardDeviation([[], [], []]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.PooledStandardDeviation([[1], [], [3], []]), 0)
    self.assertAlmostEqual(
        list_of_scalar_values.PooledStandardDeviation([[1], [2], [3], [4]]), 0)
    self.assertAlmostEqual(list_of_scalar_values.PooledStandardDeviation(
        [[600, 470, 170, 430, 300],           # variance = 27130, std = 164.7
        [4000, 4020, 4230],                   # variance = 16233, std = 127.41
        [260, 700, 800, 900, 0, 120, 150]]),  # variance = 136348, std = 369.2
        282.7060,  # SQRT((27130 4 + 16233*2 + 136348*6)/12)
        places=4)
    self.assertAlmostEqual(list_of_scalar_values.PooledStandardDeviation(
        [[600, 470, 170, 430, 300],
         [4000, 4020, 4230],
         [260, 700, 800, 900, 0, 120, 150]],
        list_of_variances=[100000, 200000, 300000]),
        465.47466,  # SQRT((100000*4 + 200000* 2 + 300000*6)/12)
        places=4)

class TestBase(unittest.TestCase):
  def setUp(self):
    story_set = story.StorySet(base_dir=os.path.dirname(__file__))
    story_set.AddStory(
        page_module.Page('http://www.bar.com/', story_set, story_set.base_dir))
    story_set.AddStory(
        page_module.Page('http://www.baz.com/', story_set, story_set.base_dir))
    story_set.AddStory(
        page_module.Page('http://www.foo.com/', story_set, story_set.base_dir))
    self.story_set = story_set

  @property
  def pages(self):
    return self.story_set.stories

class ValueTest(TestBase):
  def testListSamePageMergingWithSamePageConcatenatePolicy(self):
    page0 = self.pages[0]
    v0 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [10, 9, 9, 7], same_page_merge_policy=value.CONCATENATE)
    v1 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [300, 302, 303, 304], same_page_merge_policy=value.CONCATENATE)
    self.assertTrue(v1.IsMergableWith(v0))

    vM = (list_of_scalar_values.ListOfScalarValues.
          MergeLikeValuesFromSamePage([v0, v1]))
    self.assertEquals(page0, vM.page)
    self.assertEquals('x', vM.name)
    self.assertEquals('unit', vM.units)
    self.assertEquals(value.CONCATENATE, vM.same_page_merge_policy)
    self.assertEquals(True, vM.important)
    self.assertEquals([10, 9, 9, 7, 300, 302, 303, 304], vM.values)
    # SQRT((19/12 * 3 + 35/12 * 3)/6) = 1.5
    self.assertAlmostEqual(1.5, vM.std)

  def testListSamePageMergingWithPickFirstPolicy(self):
    page0 = self.pages[0]
    v0 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [1, 2], same_page_merge_policy=value.PICK_FIRST)
    v1 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [3, 4], same_page_merge_policy=value.PICK_FIRST)
    self.assertTrue(v1.IsMergableWith(v0))

    vM = (list_of_scalar_values.ListOfScalarValues.
          MergeLikeValuesFromSamePage([v0, v1]))
    self.assertEquals(page0, vM.page)
    self.assertEquals('x', vM.name)
    self.assertEquals('unit', vM.units)
    self.assertEquals(value.PICK_FIRST, vM.same_page_merge_policy)
    self.assertEquals(True, vM.important)
    self.assertEquals([1, 2], vM.values)

  def testListDifferentPageMerging(self):
    page0 = self.pages[0]
    page1 = self.pages[1]
    v0 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [1, 2], same_page_merge_policy=value.CONCATENATE)
    v1 = list_of_scalar_values.ListOfScalarValues(
        page1, 'x', 'unit',
        [3, 4], same_page_merge_policy=value.CONCATENATE)
    self.assertTrue(v1.IsMergableWith(v0))

    vM = (list_of_scalar_values.ListOfScalarValues.
          MergeLikeValuesFromDifferentPages([v0, v1]))
    self.assertEquals(None, vM.page)
    self.assertEquals('x', vM.name)
    self.assertEquals('unit', vM.units)
    self.assertEquals(value.CONCATENATE, vM.same_page_merge_policy)
    self.assertEquals(True, vM.important)
    self.assertEquals([1, 2, 3, 4], vM.values)

  def testListWithNoneValueMerging(self):
    page0 = self.pages[0]
    v0 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [1, 2], same_page_merge_policy=value.CONCATENATE)
    v1 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        None, same_page_merge_policy=value.CONCATENATE, none_value_reason='n')
    self.assertTrue(v1.IsMergableWith(v0))

    vM = (list_of_scalar_values.ListOfScalarValues.
          MergeLikeValuesFromSamePage([v0, v1]))
    self.assertEquals(None, vM.values)
    self.assertEquals(none_values.MERGE_FAILURE_REASON,
                      vM.none_value_reason)

  def testListWithNoneValueMustHaveNoneReason(self):
    page0 = self.pages[0]
    self.assertRaises(none_values.NoneValueMissingReason,
                      lambda: list_of_scalar_values.ListOfScalarValues(
                          page0, 'x', 'unit', None))

  def testListWithNoneReasonMustHaveNoneValue(self):
    page0 = self.pages[0]
    self.assertRaises(none_values.ValueMustHaveNoneValue,
                      lambda: list_of_scalar_values.ListOfScalarValues(
                          page0, 'x', 'unit', [1, 2],
                          none_value_reason='n'))

  def testAsDict(self):
    v = list_of_scalar_values.ListOfScalarValues(
        None, 'x', 'unit', [1, 2],
        same_page_merge_policy=value.PICK_FIRST, important=False)
    d = v.AsDictWithoutBaseClassEntries()

    self.assertEquals(d['values'], [1, 2])
    self.assertAlmostEqual(d['std'], 0.7071, places=4)

  def testMergedValueAsDict(self):
    page0 = self.pages[0]
    v0 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [10, 9, 9, 7], same_page_merge_policy=value.CONCATENATE)
    v1 = list_of_scalar_values.ListOfScalarValues(
        page0, 'x', 'unit',
        [300, 302, 303, 304], same_page_merge_policy=value.CONCATENATE)
    self.assertTrue(v1.IsMergableWith(v0))

    vM = (list_of_scalar_values.ListOfScalarValues.
          MergeLikeValuesFromSamePage([v0, v1]))
    d = vM.AsDict()
    self.assertEquals(d['values'], [10, 9, 9, 7, 300, 302, 303, 304])
    # SQRT((19/12 * 3 + 35/12 * 3)/6)
    self.assertAlmostEqual(d['std'], 1.5)

  def testNoneValueAsDict(self):
    v = list_of_scalar_values.ListOfScalarValues(
        None, 'x', 'unit', None, same_page_merge_policy=value.PICK_FIRST,
        important=False, none_value_reason='n')
    d = v.AsDictWithoutBaseClassEntries()

    self.assertEquals(d, {
          'values': None,
          'none_value_reason': 'n',
          'std': None
        })

  def testFromDictInts(self):
    d = {
      'type': 'list_of_scalar_values',
      'name': 'x',
      'units': 'unit',
      'values': [1, 2],
      'std': 0.7071
    }
    v = value.Value.FromDict(d, {})

    self.assertTrue(isinstance(v, list_of_scalar_values.ListOfScalarValues))
    self.assertEquals(v.values, [1, 2])
    self.assertEquals(v.std, 0.7071)

  def testFromDictFloats(self):
    d = {
      'type': 'list_of_scalar_values',
      'name': 'x',
      'units': 'unit',
      'values': [1.3, 2.7, 4.5, 2.1, 3.4],
      'std': 0.901
    }
    v = value.Value.FromDict(d, {})

    self.assertTrue(isinstance(v, list_of_scalar_values.ListOfScalarValues))
    self.assertEquals(v.values, [1.3, 2.7, 4.5, 2.1, 3.4])
    self.assertEquals(v.std, 0.901)

  def testFromDictNoneValue(self):
    d = {
      'type': 'list_of_scalar_values',
      'name': 'x',
      'units': 'unit',
      'values': None,
      'std': None,
      'none_value_reason': 'n'
    }
    v = value.Value.FromDict(d, {})

    self.assertTrue(isinstance(v, list_of_scalar_values.ListOfScalarValues))
    self.assertEquals(v.values, None)
    self.assertEquals(v.none_value_reason, 'n')


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/compute/v1/compute.proto

package com.google.cloud.compute.v1;

public interface EnableXpnResourceProjectRequestOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.compute.v1.EnableXpnResourceProjectRequest)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * Project ID for this request.
   *

   *
   *
   * string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"];
   *
   *
   * @return The project.
   */
  java.lang.String getProject();
  /**
   *
   *
   *

   * Project ID for this request.
   *

   *
   *
   * string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"];
   *
   *
   * @return The bytes for project.
   */
  com.google.protobuf.ByteString getProjectBytes();

  /**
   *
   *
   *

   * The body resource for this request
   *

   *
   *
   * .google.cloud.compute.v1.ProjectsEnableXpnResourceRequest projects_enable_xpn_resource_request_resource = 421980207 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return Whether the projectsEnableXpnResourceRequestResource field is set.
   */
  boolean hasProjectsEnableXpnResourceRequestResource();
  /**
   *
   *
   *

   * The body resource for this request
   *

   *
   *
   * .google.cloud.compute.v1.ProjectsEnableXpnResourceRequest projects_enable_xpn_resource_request_resource = 421980207 [(.google.api.field_behavior) = REQUIRED];
   *
   *
   * @return The projectsEnableXpnResourceRequestResource.
   */
  com.google.cloud.compute.v1.ProjectsEnableXpnResourceRequest
      getProjectsEnableXpnResourceRequestResource();
  /**
   *
   *
   *

   * The body resource for this request
   *

   *
   *
   * .google.cloud.compute.v1.ProjectsEnableXpnResourceRequest projects_enable_xpn_resource_request_resource = 421980207 [(.google.api.field_behavior) = REQUIRED];
   *
   */
  com.google.cloud.compute.v1.ProjectsEnableXpnResourceRequestOrBuilder
      getProjectsEnableXpnResourceRequestResourceOrBuilder();

  /**
   *
   *
   *

   * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   *

   *
   * optional string request_id = 37109963;
   *
   * @return Whether the requestId field is set.
   */
  boolean hasRequestId();
  /**
   *
   *
   *

   * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   *

   *
   * optional string request_id = 37109963;
   *
   * @return The requestId.
   */
  java.lang.String getRequestId();
  /**
   *
   *
   *

   * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
   *

   *
   * optional string request_id = 37109963;
   *
   * @return The bytes for requestId.
   */
  com.google.protobuf.ByteString getRequestIdBytes();
}


text:
package org.apache.syncope.core.util;

import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import org.apache.commons.jexl2.Expression;
import org.apache.commons.jexl2.JexlContext;
import org.apache.commons.jexl2.JexlEngine;
import org.apache.commons.jexl2.JexlException;
import org.apache.commons.jexl2.MapContext;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.syncope.common.to.AbstractAttributableTO;
import org.apache.syncope.common.to.AttributeTO;
import org.apache.syncope.core.persistence.beans.AbstractAttr;
import org.apache.syncope.core.persistence.beans.AbstractDerAttr;
import org.apache.syncope.core.persistence.beans.AbstractVirAttr;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @see http://commons.apache.org/jexl/reference/index.html
 */
public class JexlUtil {

    /**
     * Logger.
     *
     */
    private static final Logger LOG = LoggerFactory.getLogger(JexlUtil.class);

    private static final String[] IGNORE_FIELDS = {"password", "clearPassword", "serialVersionUID"};

    @Autowired
    private JexlEngine jexlEngine;

    public boolean isExpressionValid(final String expression) {
        boolean result;
        try {
            jexlEngine.createExpression(expression);
            result = true;
        } catch (JexlException e) {
            LOG.error("Invalid jexl expression: " + expression, e);
            result = false;
        }

        return result;
    }

    public String evaluate(final String expression, final JexlContext jexlContext) {
        String result = "";

        if (StringUtils.isNotBlank(expression) && jexlContext != null) {
            try {
                Expression jexlExpression = jexlEngine.createExpression(expression);
                Object evaluated = jexlExpression.evaluate(jexlContext);
                if (evaluated != null) {
                    result = evaluated.toString();
                }
            } catch (JexlException e) {
                LOG.error("Invalid jexl expression: " + expression, e);
            }
        } else {
            LOG.debug("Expression not provided or invalid context");
        }

        return result;
    }

    public JexlContext addFieldsToContext(final Object attributable, final JexlContext jexlContext) {
        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        final Field[] fields = attributable.getClass().getDeclaredFields();
        for (int i = 0; i < fields.length; i++) {
            try {
                Field field = fields[i];
                field.setAccessible(true);
                final String fieldName = field.getName();
                if ((!field.isSynthetic()) && (!fieldName.startsWith("pc"))
                        && (!ArrayUtils.contains(IGNORE_FIELDS, fieldName))
                        && (!Iterable.class.isAssignableFrom(field.getType()))
                        && (!field.getType().isArray())) {

                    final Object fieldValue = field.get(attributable);

                    context.set(fieldName, fieldValue == null
                            ? ""
                            : (field.getType().equals(Date.class)
                            ? DataFormat.format((Date) fieldValue, false)
                            : fieldValue));

                    LOG.debug("Add field {} with value {}", fieldName, fieldValue);
                }
            } catch (Exception e) {
                LOG.error("Reading class attributes error", e);
            }
        }

        return context;
    }

    public JexlContext addAttrsToContext(final Collection<? extends AbstractAttr> attributes,
            final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractAttr attr : attributes) {
            List<String> attributeValues = attr.getValuesAsStrings();
            String expressionValue = attributeValues.isEmpty()
                    ? ""
                    : attributeValues.get(0);

            LOG.debug("Add attribute {} with value {}", attr.getSchema().getName(), expressionValue);

            context.set(attr.getSchema().getName(), expressionValue);
        }

        return context;
    }

    public JexlContext addDerAttrsToContext(final Collection<? extends AbstractDerAttr> derAttrs,
            final Collection<? extends AbstractAttr> attrs, final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractDerAttr derAttr : derAttrs) {
            String expressionValue = derAttr.getValue(attrs);
            if (expressionValue == null) {
                expressionValue = "";
            }

            LOG.debug("Add derived attribute {} with value {}", derAttr.getDerivedSchema().getName(), expressionValue);

            context.set(derAttr.getDerivedSchema().getName(), expressionValue);
        }

        return context;
    }

    public JexlContext addVirAttrsToContext(final Collection<? extends AbstractVirAttr> virAttrs,
            final JexlContext jexlContext) {

        JexlContext context = jexlContext == null
                ? new MapContext()
                : jexlContext;

        for (AbstractVirAttr virAttr : virAttrs) {
            List<String> attributeValues = virAttr.getValues();
            String expressionValue = attributeValues.isEmpty()
                    ? ""
                    : attributeValues.get(0);

            LOG.debug("Add virtual attribute {} with value {}", virAttr.getVirtualSchema().getName(), expressionValue);

            context.set(virAttr.getVirtualSchema().getName(), expressionValue);
        }

        return context;
    }

    public String evaluate(final String expression, final AbstractAttributableTO attributableTO) {
        final JexlContext context = new MapContext();

        addFieldsToContext(attributableTO, context);

        for (AttributeTO attr : attributableTO.getAttributes()) {
            List<String> values = attr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add attribute {} with value {}", attr.getSchema(), expressionValue);

            context.set(attr.getSchema(), expressionValue);
        }
        for (AttributeTO derAttr : attributableTO.getDerivedAttributes()) {
            List<String> values = derAttr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add derived attribute {} with value {}", derAttr.getSchema(), expressionValue);

            context.set(derAttr.getSchema(), expressionValue);
        }
        for (AttributeTO virAttr : attributableTO.getVirtualAttributes()) {
            List<String> values = virAttr.getValues();
            String expressionValue = values.isEmpty()
                    ? ""
                    : values.get(0);

            LOG.debug("Add virtual attribute {} with value {}", virAttr.getSchema(), expressionValue);

            context.set(virAttr.getSchema(), expressionValue);
        }

        // Evaluate expression using the context prepared before
        return evaluate(expression, context);
    }
}


text:
/**
 * All the CSS types in the 'types' namespace
 */
import * as types from '../types';
export declare type StylesTarget = {
    textContent: string | null;
};
/**
 * Maintains a single stylesheet and keeps it in sync with requested styles
 */
export declare class TypeStyle {
    private _autoGenerateTag;
    private _freeStyle;
    private _pending;
    private _pendingRawChange;
    private _raw;
    private _tag?;
    /**
     * We have a single stylesheet that we update as components register themselves
     */
    private _lastFreeStyleChangeId;
    constructor({autoGenerateTag}: {
        autoGenerateTag: boolean;
    });
    /**
     * Only calls cb all sync operations settle
     */
    private _afterAllSync(cb);
    private _getTag();
    /** Checks if the style tag needs updating and if so queues up the change */
    private _styleUpdated();
    /**
     * Insert `raw` CSS as a string. This is useful for e.g.
     * - third party CSS that you are customizing with template strings
     * - generating raw CSS in JavaScript
     * - reset libraries like normalize.css that you can use without loaders
     */
    cssRaw: (mustBeValidCSS: string) => void;
    /**
     * Takes CSSProperties and registers it to a global selector (body, html, etc.)
     */
    cssRule: (selector: string, ...objects: types.NestedCSSProperties[]) => void;
    /**
     * Renders styles to the singleton tag imediately
     * NOTE: You should only call it on initial render to prevent any non CSS flash.
     * After that it is kept sync using `requestAnimationFrame` and we haven't noticed any bad flashes.
     **/
    forceRenderStyles: () => void;
    /**
     * Utility function to register an @font-face
     */
    fontFace: (...fontFace: types.FontFace[]) => void;
    /**
     * Allows use to use the stylesheet in a node.js environment
     */
    getStyles: () => string;
    /**
     * Takes keyframes and returns a generated animationName
     */
    keyframes: (frames: types.KeyFrames) => string;
    /**
     * Helps with testing. Reinitializes FreeStyle + raw
     */
    reinit: () => void;
    /** Sets the target tag where we write the css on style updates */
    setStylesTarget: (tag: StylesTarget) => void;
    /**
     * Takes CSSProperties and return a generated className you can use on your component
     */
    style: (...objects: (false | types.NestedCSSProperties | null | undefined)[]) => string;
}


text:
package com.github.dakusui.jcunit8.examples.pict;

import com.github.dakusui.jcunit8.factorspace.Parameter;
import com.github.dakusui.jcunit8.runners.helpers.ParameterUtils;
import com.github.dakusui.jcunit8.runners.junit4.JCUnit8;
import com.github.dakusui.jcunit8.runners.junit4.annotations.Condition;
import com.github.dakusui.jcunit8.runners.junit4.annotations.From;
import com.github.dakusui.jcunit8.runners.junit4.annotations.ParameterSource;
import org.junit.Test;
import org.junit.runner.JUnitCore;
import org.junit.runner.RunWith;

import java.util.Objects;

/**
 * Issue-11 of PICT
 *
 * [0 2017/08/08T04:23:14JST hiroshi@alexios ~/Documents/pict]
 * $ ./pict issue-13.pict
 * ^C
 * [130 2017/08/08T07:02:50JST hiroshi@alexios ~/Documents/pict]
 * $ cat issue-13.pict
 * Eingangskanal: EVA_Anlageberatung, EVA_Order, EVA_Sonderweg, EVA_Sparplan, EVA_Neuemission, EVA_Direkteinstieg, HOST_T19000, HOST_T19001, HOST_T19901, HOST_T19750, HOST_T28900, Onlinebanking_PC, Onlinebanking_MSB, Onlinebanking_Neuemission_PC, Onlinebanking_Neuemission_MSB, Onlinebanking_Tablet_PC, Infobroker, commerzbank_de_pib
 * Finanzinstrument: Aktie, Unstrukturierte_Anleihe, strukturierte_Anleihe, Inv.Fonds, OIF, Zertifikat, Optionsschein, Xetra_Gold_ETC, EMISID
 * Prod
 *
 *

 * JCUnit is at least slightly better at handling constraints than pict.
 * pict cannot finish generating test suite from the same model in 2.5 hours but
 * JCUnit does in less than 2 hours.
 */
@SuppressWarnings("SimplifiableIfStatement")
@RunWith(JCUnit8.class)
public class Issue13 {
  /**
   * Eingangskanal:
   *

   * EVA_Anlageberatung, EVA_Order, EVA_Sonderweg, EVA_Sparplan, EVA_Neuemission,
   * EVA_Direkteinstieg, HOST_T19000, HOST_T19001, HOST_T19901, HOST_T19750,
   * HOST_T28900, Onlinebanking_PC, Onlinebanking_MSB, Onlinebanking_Neuemission_PC,
   * Onlinebanking_Neuemission_MSB, Onlinebanking_Tablet_PC, Infobroker, commerzbank_de_pib
   */
  @ParameterSource
  public Parameter.Factory<String> eingangskanal() {
    return ParameterUtils.simple(
        "EVA_Anlageberatung", "EVA_Order", "EVA_Sonderweg", "EVA_Sparplan", "EVA_Neuemission",
        "EVA_Direkteinstieg", "HOST_T19000", "HOST_T19001", "HOST_T19901", "HOST_T19750",
        "HOST_T28900", "Onlinebanking_PC", "Onlinebanking_MSB", "Onlinebanking_Neuemission_PC",
        "Onlinebanking_Neuemission_MSB", "Onlinebanking_Tablet_PC", "Infobroker", "commerzbank_de_pib"
    );
  }

  /**
   * Finanzinstrument:
   *

   * Aktie, Unstrukturierte_Anleihe, strukturierte_Anleihe, Inv.Fonds, OIF,
   * Zertifikat, Optionsschein, Xetra_Gold_ETC, EMISID
   */
  @ParameterSource
  public Parameter.Factory<String> finanzinstrument() {
    return ParameterUtils.simple(
        "Aktie", "Unstrukturierte_Anleihe", "strukturierte_Anleihe", "Inv.Fonds", "OIF",
        "Zertifikat", "Optionsschein", "Xetra_Gold_ETC", "EMISID"
    );
  }

  /**
   * Produktzyklus:
   *

   * Neuemission_Information, Neuemission_offen, Neuemission_geschlossen, Neuemission_abgerechnet,
   * Sekundaermarkt, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> produktzyklus() {
    return ParameterUtils.simple(
        "Neuemission_Information", "Neuemission_offen", "Neuemission_geschlossen", "Neuemission_abgerechnet",
        "Sekundaermarkt", "n/a"
    );
  }

  /**
   * Dienstleistungsart: Anlageberatung, beratungsfreies_Geschaeft, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> dienstleistungsart() {
    return ParameterUtils.simple(
        "Anlageberatung", "beratungsfreies_Geschaeft", "n/a"
    );
  }

  /**
   * Orderart:
   * Kauf(Beratungsdatum_gueltig), Kauf_(ohne_Beratungsdatum), Verkauf,
   * aenderung, Streichung, Storno, Berichtigungsauftrag, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> orderart() {
    return ParameterUtils.simple(
        "Kauf(Beratungsdatum_gueltig)", "Kauf_(ohne_Beratungsdatum)", "Verkauf",
        "aenderung", "Streichung", "Storno", "Berichtigungsauftrag", "n/a"
    );
  }

  /**
   * Initiator: Kunde, Bank, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> initiator() {
    return ParameterUtils.simple(
        "Kunde", "Bank", "n/a"
    );
  }

  /**
   * Auftragserteilung: telefonisch, persoenlich, schriftlich, Haustuergeschaeft, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> auftragserteilung() {
    return ParameterUtils.simple(
        "telefonisch", "persoenlich", "schriftlich", "Haustuergeschaeft", "n/a"
    );
  }

  /**
   * Bereitstellungsdokumente:
   *

   * Beratungsprotokoll_Kunde, Beratungsprotokoll_Interessent, Beratungsprotokoll_Potenzial,
   * Nachtraeglicher_KID-Versand, n/a
   */
  @ParameterSource
  public Parameter.Factory<String> bereitstellungsdokumente() {
    return ParameterUtils.simple(
        "Beratungsprotokoll_Kunde", "Beratungsprotokoll_Interessent", "Beratungsprotokoll_Potenzial",
        "Nachtraeglicher_KID-Versand", "n/a"
    );
  }

  /**
   * UDAL-Status:
   *

   * Normalbetrieb, Back_up-Betrieb, PRIIP,ohne_KID, WKN_nicht_vorhanden, WKN_inaktiv/geloescht,
   * defektes_Dokument, Virus, non-PRIIP_auf_Blackliste, PRIIP_auf_Blackliste, UDAL_nicht_verfuegbar,
   * n/a
   */
  @ParameterSource
  public Parameter.Factory<String> udalStatus() {
    return ParameterUtils.simple(
        "Normalbetrieb", "Back_up-Betrieb", "PRIIP", "ohne_KID", "WKN_nicht_vorhanden",
        "WKN_inaktiv/geloescht", "defektes_Dokument", "Virus", "non-PRIIP_auf_Blackliste",
        "PRIIP_auf_Blackliste", "UDAL_nicht_verfuegbar", "n/a"
    );
  }

  /**
   * Abruf_Infoblaetter:
   *

   * WA_von_FWW, PIB_von_DOTi, PIB_von_C&M-FIC, PIB_von_PC_PM,
   * KID_von_PC_PM, KID_von_DOTi, KID_von_externem_Hersteller
   */
  @ParameterSource
  public Parameter.Factory<String> abruf_Infoblaetter() {
    return ParameterUtils.simple(
        "WA_von_FWW", "PIB_von_DOTi", "PIB_von_C&M-FIC", "PIB_von_PC_PM",
        "KID_von_PC_PM", "KID_von_DOTi", "KID_von_externem_Hersteller"
    );
  }

  ////
  //1
  //
  //IF [Eingangskanal] = "HOST_T19901"
  //THEN [Orderart] <> "Kauf_(Beratungsdatum_gueltig)"
  //AND [Produktzyklus] <> "Neuemission_offen"
  //AND [Produktzyklus] <> "n/a"
  //AND [Dienstleistungsart] <> "n/a"
  //AND [Orderart] <> "n/a"
  //AND [Initiator] = "n/a"
  //AND [Auftragserteilung] = "n/a"
  //AND [Bereitstellungsdokumente]= "n/a"
  //AND [UDAL-Status] = "n/a";
  @Condition(constraint = true)
  public boolean constraint1(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus
  ) {
    //noinspection SimplifiableIfStatement
    if (Objects.equals(eingangskanal, "HOST_T19901"))
      return (
          !Objects.equals(orderart, "Kauf_(Beratungsdatum_gueltig)") &&
              !Objects.equals(produktzyklus, "Neuemission_offen") &&
              !Objects.equals(produktzyklus, "n/a") &&
              !Objects.equals(dienstleistungsart, "n/a") &&
              !Objects.equals(orderart, "n/a") &&
              Objects.equals(initiator, "n/a") &&
              Objects.equals(auftragserteilung, "n/a") &&
              Objects.equals(bereitstellungsdokumente, "n/a") &&
              Objects.equals(udalStatus, "n/a")
      );
    return true;
  }

  /*/
  ////2
  //
  //IF [Eingangskanal] in {"HOST_T19000", "HOST_T19001", "HOST_T19750", "HOST_T28900"}
  //THEN [Produktzyklus] <> "Neuemission_Information"
  //AND [Produktzyklus] <> "Neuemission_offen"
  //AND [Produktzyklus] <> "n/a"
  //AND [Dienstleistungsart] <> "n/a"
  //AND [Orderart] <> "n/a"
  //AND [Initiator] = "n/a"
  //AND [Auftragserteilung] = "n/a"
  //AND [Bereitstellungsdokumente]= "n/a"
  //AND [UDAL-Status] = "n/a";
  @Condition(constraint = true)
  public boolean constraint2(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus
  ) {
    if (asList("HOST_T19000", "HOST_T19001", "HOST_T19750", "HOST_T28900").contains(eingangskanal)) {
      return !produktzyklus.equals("Neuemission_Information") &&
          !produktzyklus.equals("Neuemission_offen") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("n/a") &&
          initiator.equals("n/a") &&
          auftragserteilung.equals("n/a") &&
          bereitstellungsdokumente.equals("n/a") &&
          udalStatus.equals("n/a");
    }
    return true;
  }

  ////3
  //
  //IF [Eingangskanal] like "EVA_*"
  //THEN [Initiator] <> "n/a"
  //AND [Produktzyklus] <> "n/a"
  //AND [Dienstleistungsart] <> "n/a"
  //AND [Orderart] <> "n/a"
  //AND [Auftragserteilung] <> "n/a"
  //AND [Bereitstellungsdokumente] <> "n/a"
  //AND [UDAL-Status] <> "n/a";
  @Condition(constraint = true)
  public boolean constraint3(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus
  ) {
    if (eingangskanal.startsWith("EVA_"))
      return !initiator.equals("n/a") &&
          !produktzyklus.equals("n/a") &&
          !orderart.equals("n/a") &&
          !auftragserteilung.equals("n/a") &&
          !bereitstellungsdokumente.equals("n/a") &&
          !udalStatus.equals("n/a");
    return true;
  }

  ////4
  //
  //IF [Eingangskanal] IN {"Onlinebanking_PC", "Onlinebanking_MSB", "Onlinebanking_Tablet_PC"}
  //THEN [Produktzyklus] <> "Neuemission_Information"
  //AND [Produktzyklus] <> "Neuemission_offen"
  //AND [Produktzyklus] <> "n/a"
  //AND [Dienstleistungsart] <> "n/a"
  //AND [Orderart] <> "n/a";
  @Condition(constraint = true)
  public boolean constraint4(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart
  ) {
    if (asList("Onlinebanking_PC", "Onlinebanking_MSB", "Onlinebanking_Tablet_PC").contains(eingangskanal))
      return !produktzyklus.equals("Neuemission_Information") &&
          !produktzyklus.equals("Neuemission_offen") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("n/a");
    return true;
  }

  ////5
  //
  //IF [Eingangskanal] like "Onlinebanking*"
  //THEN [Dienstleistungsart]="beratungsfreies_Geschaeft"
  //AND [Produktzyklus] <> "n/a"
  //AND [Dienstleistungsart] <> "n/a"
  //AND [Orderart] <> "Storno"
  //AND [Orderart] <> "Berichtigungsauftrag"
  //AND [Orderart] <> "Kauf_(Beratungsdatum_gueltig)"
  //AND [Orderart] <> "n/a"
  //AND [Initiator] = "n/a"
  //AND [Auftragserteilung] = "n/a"
  //AND [Bereitstellungsdokumente] = "n/a"
  //AND [UDAL-Status] <>"Back_up-Betrieb";
  @Condition(constraint = true)
  public boolean constraint5(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus
  ) {
    if (eingangskanal.startsWith("Onlinebanking"))
      // !dienstleistungsart.equals("n/a") is always true.
      //noinspection ConstantConditions
      return dienstleistungsart.equals("beratungsfreies_Geschaeft") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("Storno") &&
          !orderart.equals("Berichtigungsauftrag") &&
          !orderart.equals("Kauf_(Beratungsdatum_gueltig)") &&
          !orderart.equals("n/a") &&
          initiator.equals("n/a") &&
          auftragserteilung.equals("n/a") &&
          bereitstellungsdokumente.equals("n/a") &&
          !udalStatus.equals("Back_up-Betrieb");
    return true;
  }

  ////6
  //IF [Eingangskanal] IN {"EVA_Sonderweg", "EVA_Sparplan", "EVA_Direkteinstieg", "EVA Order"}
  //THEN [Produktzyklus] <>"Neuemission_Information"
  //AND [Produktzyklus] <>"Neuemission_offen"
  //AND [Produktzyklus] <>"n/a"
  //AND [Dienstleistungsart] <>"n/a"
  //AND [Orderart] <>"n/a";
  @Condition(constraint = true)
  public boolean constraint6(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart
  ) {
    if (asList("EVA_Sonderweg", "EVA_Sparplan", "EVA_Direkteinstieg", "EVA Order").contains(eingangskanal))
      return !produktzyklus.equals("Neuemission_Information") &&
          !produktzyklus.equals("Neuemission_offen") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("n/a");
    return true;
  }

  //7
  //IF [Eingangskanal] IN {"EVA_Sonderweg", "EVA_Sparplan", "EVA_Direkteinstieg"}
  //THEN [Orderart] <>"Storno"
  //AND [Orderart] <>"Berichtigungsauftrag"
  //AND [Orderart] <>"Kauf_(Beratungsdatum_gueltig)"
  //AND [Produktzyklus] <>"n/a"
  //AND [Dienstleistungsart] <>"n/a"
  //AND [Orderart] <>"n/a";
  @Condition(constraint = true)
  public boolean constraint7(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart
  ) {
    if (asList("EVA_Sonderweg", "EVA_Sparplan", "EVA_Direkteinstieg").contains(eingangskanal))
      return !orderart.equals("Storno") &&
          !orderart.equals("Berichtigungsauftrag") &&
          !orderart.equals("Kauf_(Beratungsdatum_gueltig)") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("n/a");
    return true;
  }

  //8
  //IF [Eingangskanal] in {"EVA_Anlageberatung", "EVA_Neuemission", "EVA_Order"}
  //THEN [Orderart] <>"Storno"
  //AND [Orderart] <>"Berichtigungsauftrag"
  //AND [Produktzyklus] <>"n/a"
  //AND [Dienstleistungsart] <>"n/a"
  //AND [Orderart] <>"n/a";
  @Condition(constraint = true)
  public boolean constraint8(
      @From("eingangskanal") String eingangskanal,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart
  ) {
    if (asList("EVA_Anlageberatung", "EVA_Neuemission", "EVA_Order").contains(eingangskanal))
      return !orderart.equals("Storno") &&
          !orderart.equals("Berichtigungsauftrag") &&
          !produktzyklus.equals("n/a") &&
          !dienstleistungsart.equals("n/a") &&
          !orderart.equals("n/a");
    return true;
  }

  //9
  //
  //IF [Eingangskanal] IN {"Infobroker", "commerzbank_de_pib"}
  //THEN [Finanzinstrument] <> "EMISID"
  //AND [Produktzyklus] = "n/a"
  //AND [Dienstleistungsart] = "n/a"
  //AND [Orderart] = "n/a"
  //AND [Initiator] = "n/a"
  //AND [Auftragserteilung] = "n/a"
  //AND [Bereitstellungsdokumente]= "n/a"
  //AND [UDAL-Status] <> "Back_up-Betrieb";
  @Condition(constraint = true)
  public boolean constraint9(
      @From("eingangskanal") String eingangskanal,
      @From("finanzinstrument") String finanzinstrument,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus
  ) {
    if (asList("Infobroker", "commerzbank_de_pib").contains(eingangskanal))
      return !finanzinstrument.equals("EMISID") &&
          produktzyklus.equals("n/a") &&
          dienstleistungsart.equals("n/a") &&
          orderart.equals("n/a") &&
          initiator.equals("n/a") &&
          auftragserteilung.equals("n/a") &&
          bereitstellungsdokumente.equals("n/a") &&
          !udalStatus.equals("Back_up-Betrieb");
    return true;
  }
  /*/

  @Test
  public void test(
      @From("eingangskanal") String eingangskanal,
      @From("finanzinstrument") String finanzinstrument,
      @From("orderart") String orderart,
      @From("produktzyklus") String produktzyklus,
      @From("dienstleistungsart") String dienstleistungsart,
      @From("initiator") String initiator,
      @From("auftragserteilung") String auftragserteilung,
      @From("bereitstellungsdokumente") String bereitstellungsdokumente,
      @From("udalStatus") String udalStatus,
      @From("abruf_Infoblaetter") String abruf_Infoblaetter
  ) {
    System.out.printf("%s,%s,%s,%s,%s,%s,%s,%s,%s,%s%n",
        eingangskanal,
        finanzinstrument,
        orderart,
        produktzyklus,
        dienstleistungsart,
        initiator,
        auftragserteilung,
        bereitstellungsdokumente,
        udalStatus,
        abruf_Infoblaetter
    );
  }

  public static void main(String... args) {
    long before = System.currentTimeMillis();
    new JUnitCore().run(Issue13.class);
    System.out.println(System.currentTimeMillis() - before);
  }
}


text:
package com.timogroup.tomcat.container;

import com.timogroup.tomcat.util.ProgramArgs;

import java.io.File;
import java.io.FileNotFoundException;

/**
 * Created by TimoRD on 2016/10/26.
 */
public class Bootstrap {

    public static void main(String[] args) throws Exception {
        ProgramArgs programArgs = ProgramArgs.parse(args);
        if (programArgs.hasKey("--help")) {
            showHelp();
            return;
        }

        File war;
        if (!programArgs.hasKey("--war")) {
            war = new File("app.war");
        } else {
            war = new File(programArgs.getArg("--war"));
        }
        if (!war.exists()) {
            throw new FileNotFoundException(war.getAbsolutePath());
        }

        WarTomcatContainer tomcat = new WarTomcatContainer(war);
        if (programArgs.hasKey("--display")) {
            String display = getString(programArgs.getArg("--display"), tomcat.getDisplayName());
            tomcat.setDisplayName(display);
        }
        if (programArgs.hasKey("--port")) {
            int port = toInt(programArgs.getArg("--port"), tomcat.getPort());
            tomcat.setPort(port);
        }
        if (programArgs.hasKey("--path")) {
            String path = getString(programArgs.getArg("--path"), tomcat.getPath());
            tomcat.setPath(path);
        }
        if (programArgs.hasKey("--minThreads")) {
            int threads = toInt(programArgs.getArg("--minThreads"), tomcat.getMinThreads());
            tomcat.setMinThreads(threads);
        }
        if (programArgs.hasKey("--maxThreads")) {
            int threads = toInt(programArgs.getArg("--maxThreads"), tomcat.getMaxThreads());
            tomcat.setMaxThreads(threads);
        }
        if (programArgs.hasKey("--connections")) {
            int connections = toInt(programArgs.getArg("--connections"), tomcat.getMaxConnections());
            tomcat.setMaxConnections(connections);
        }
        if (programArgs.hasKey("--encoding")) {
            String encoding = getString(programArgs.getArg("--encoding"), tomcat.getEncoding());
            tomcat.setEncoding(encoding);
        }
        if (programArgs.hasKey("--timeout")) {
            int timeout = toInt(programArgs.getArg("--timeout"), tomcat.getConnectionTimeout());
            tomcat.setConnectionTimeout(timeout);
        }

        tomcat.startAwait();
    }

    private static void showHelp() {
        System.out.println("--war: war path (default: app.war)");
        System.out.println("--display: display name (default: tomcat)");
        System.out.println("--port: port (default: 8080)");
        System.out.println("--path: path (default: /)");
        System.out.println("--minThreads: number of threads (default: 200)");
        System.out.println("--maxThreads: number of threads (default: 300)");
        System.out.println("--connections: number of connections (default: 10000)");
        System.out.println("--encoding: encoding (default: utf-8)");
        System.out.println("--timeout: timeout (default: 30000ms)");
    }

    private static String getString(String str, String defaultValue) {
        if (str == null || str.length() == 0) {
            return defaultValue;
        } else {
            return str;
        }
    }

    private static int toInt(String str, int defaultValue) {
        if (str == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(str);
        } catch (NumberFormatException nfe) {
            return defaultValue;
        }
    }
}


text:
package org.jetbrains.plugins.scala.worksheet.integration.repl

import org.jetbrains.plugins.scala.util.runners.{RunWithScalaVersions, TestScalaVersion}
import org.jetbrains.plugins.scala.worksheet.actions.topmenu.RunWorksheetAction.RunWorksheetActionResult
import org.jetbrains.plugins.scala.worksheet.processor.WorksheetCompiler.WorksheetCompilerResult.{Precondition, PreconditionError}

import scala.language.postfixOps

@RunWithScalaVersions(Array(TestScalaVersion.Scala_2_13))
class WorksheetReplCompileLocallyRunLocallyIntegrationTest extends WorksheetReplIntegrationBaseTest {

  override def useCompileServer: Boolean = false

  override def runInCompileServerProcess: Boolean = false

  def testSimpleDeclaration(): Unit = {
    val left = "val a = 1"
    val compilerError = PreconditionError(Precondition.ReplRequiresCompileServerProcess)
    doFailingTest(left, RunWorksheetActionResult.WorksheetRunError(compilerError))
  }
}