text:
#import <Foundation/NSObject.h>

@class NSArray, NSDictionary, NSString, NSURL, NSError;

/* Because NSBundle caches allocated instances, subclasses should be prepared
   to receive an already initialized object back from [super initWithPath:] */
@interface NSBundle : NSObject {
@private
    NSUInteger		_flags;
    id		        _cfBundle;
    NSUInteger		_reserved2;
    Class		_principalClass;
    id                  _tmp1;
    id                  _tmp2;
    void		*_reserved1;
    void		*_reserved0;
}

/* Methods for creating or retrieving bundle instances. */
+ (NSBundle *)mainBundle;
+ (NSBundle *)bundleWithPath:(NSString *)path;
- (id)initWithPath:(NSString *)path;

+ (NSBundle *)bundleWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0);
- (id)initWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0);

+ (NSBundle *)bundleForClass:(Class)aClass;
+ (NSBundle *)bundleWithIdentifier:(NSString *)identifier;

+ (NSArray *)allBundles;
+ (NSArray *)allFrameworks;

/* Methods for loading and unloading bundles. */
- (BOOL)load;
- (BOOL)isLoaded;
- (BOOL)unload;

- (BOOL)preflightAndReturnError:(NSError **)error NS_AVAILABLE(10_5, 2_0);
- (BOOL)loadAndReturnError:(NSError **)error NS_AVAILABLE(10_5, 2_0);

/* Methods for locating various components of a bundle. */
- (NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)resourceURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)executableURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)URLForAuxiliaryExecutable:(NSString *)executableName NS_AVAILABLE(10_6, 4_0);

- (NSURL *)privateFrameworksURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)sharedFrameworksURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)sharedSupportURL NS_AVAILABLE(10_6, 4_0);
- (NSURL *)builtInPlugInsURL NS_AVAILABLE(10_6, 4_0);

- (NSURL *)appStoreReceiptURL NS_AVAILABLE_MAC(10_7);

- (NSString *)bundlePath;
- (NSString *)resourcePath;
- (NSString *)executablePath;
- (NSString *)pathForAuxiliaryExecutable:(NSString *)executableName;

- (NSString *)privateFrameworksPath;
- (NSString *)sharedFrameworksPath;
- (NSString *)sharedSupportPath;
- (NSString *)builtInPlugInsPath;

/* Methods for locating bundle resources.  Instance methods locate resources in the bundle indicated by the receiver; class methods take an argument pointing to a bundle on disk.  In the class methods, bundleURL is a URL pointing to the location of a bundle on disk, and may not be nil; bundlePath is the path equivalent of bundleURL, an absolute path pointing to the location of a bundle on disk.  By contrast, subpath is a relative path to a subdirectory inside the relevant global or localized resource directory, and should be nil if the resource file in question is not in a subdirectory.  Where appropriate, localizationName is the name of a .lproj directory in the bundle, minus the .lproj extension; passing nil for localizationName retrieves only global resources, whereas using a method without this argument retrieves both global and localized resources (using the standard localization search algorithm).  */

+ (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath inBundleWithURL:(NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0);
+ (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath inBundleWithURL:(NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0);

- (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext NS_AVAILABLE(10_6, 4_0);
- (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath NS_AVAILABLE(10_6, 4_0);
- (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath localization:(NSString *)localizationName NS_AVAILABLE(10_6, 4_0);

- (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath NS_AVAILABLE(10_6, 4_0);
- (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath localization:(NSString *)localizationName NS_AVAILABLE(10_6, 4_0);

+ (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)bundlePath;
+ (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)bundlePath;

- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext;
- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath;
- (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath forLocalization:(NSString *)localizationName;

- (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)subpath;
- (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)subpath forLocalization:(NSString *)localizationName;

/* Method for retrieving localized strings. */
- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName NS_FORMAT_ARGUMENT(1);

/* Methods for obtaining various information about a bundle. */
- (NSString *)bundleIdentifier;
- (NSDictionary *)infoDictionary;
- (NSDictionary *)localizedInfoDictionary;
- (id)objectForInfoDictionaryKey:(NSString *)key;
- (Class)classNamed:(NSString *)className;
- (Class)principalClass;

/* Methods for dealing with localizations. */
- (NSArray *)localizations;
- (NSArray *)preferredLocalizations;
- (NSString *)developmentLocalization;

+ (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray;
+ (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray forPreferences:(NSArray *)preferencesArray;

/* Method for determining executable architectures. */
enum {
    NSBundleExecutableArchitectureI386      = 0x00000007,
    NSBundleExecutableArchitecturePPC       = 0x00000012,
    NSBundleExecutableArchitectureX86_64    = 0x01000007,
    NSBundleExecutableArchitecturePPC64     = 0x01000012
};

- (NSArray *)executableArchitectures NS_AVAILABLE(10_5, 2_0);

@end

#define NSLocalizedString(key, comment) \
	    [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
#define NSLocalizedStringFromTable(key, tbl, comment) \
	    [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)]
#define NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment) \
	    [bundle localizedStringForKey:(key) value:@"" table:(tbl)]
#define NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment) \
	    [bundle localizedStringForKey:(key) value:(val) table:(tbl)]

FOUNDATION_EXPORT NSString * const NSBundleDidLoadNotification;
FOUNDATION_EXPORT NSString * const NSLoadedClasses;	// notification key


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/resourcemanager/v3/organizations.proto

namespace Google\Cloud\ResourceManager\V3;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The response returned from the `SearchOrganizations` method.
 *
 * Generated from protobuf message google.cloud.resourcemanager.v3.SearchOrganizationsResponse
 */
class SearchOrganizationsResponse extends \Google\Protobuf\Internal\Message
{
    /**
     * The list of Organizations that matched the search query, possibly
     * paginated.
     *
     * Generated from protobuf field repeated .google.cloud.resourcemanager.v3.Organization organizations = 1;
     */
    private $organizations;
    /**
     * A pagination token to be used to retrieve the next page of results. If the
     * result is too large to fit within the page size specified in the request,
     * this field will be set with a token that can be used to fetch the next page
     * of results. If this field is empty, it indicates that this response
     * contains the last page of results.
     *
     * Generated from protobuf field string next_page_token = 2;
     */
    private $next_page_token = '';

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type \Google\Cloud\ResourceManager\V3\Organization[]|\Google\Protobuf\Internal\RepeatedField $organizations
     *           The list of Organizations that matched the search query, possibly
     *           paginated.
     *     @type string $next_page_token
     *           A pagination token to be used to retrieve the next page of results. If the
     *           result is too large to fit within the page size specified in the request,
     *           this field will be set with a token that can be used to fetch the next page
     *           of results. If this field is empty, it indicates that this response
     *           contains the last page of results.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Resourcemanager\V3\Organizations::initOnce();
        parent::__construct($data);
    }

    /**
     * The list of Organizations that matched the search query, possibly
     * paginated.
     *
     * Generated from protobuf field repeated .google.cloud.resourcemanager.v3.Organization organizations = 1;
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getOrganizations()
    {
        return $this->organizations;
    }

    /**
     * The list of Organizations that matched the search query, possibly
     * paginated.
     *
     * Generated from protobuf field repeated .google.cloud.resourcemanager.v3.Organization organizations = 1;
     * @param \Google\Cloud\ResourceManager\V3\Organization[]|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setOrganizations($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\ResourceManager\V3\Organization::class);
        $this->organizations = $arr;

        return $this;
    }

    /**
     * A pagination token to be used to retrieve the next page of results. If the
     * result is too large to fit within the page size specified in the request,
     * this field will be set with a token that can be used to fetch the next page
     * of results. If this field is empty, it indicates that this response
     * contains the last page of results.
     *
     * Generated from protobuf field string next_page_token = 2;
     * @return string
     */
    public function getNextPageToken()
    {
        return $this->next_page_token;
    }

    /**
     * A pagination token to be used to retrieve the next page of results. If the
     * result is too large to fit within the page size specified in the request,
     * this field will be set with a token that can be used to fetch the next page
     * of results. If this field is empty, it indicates that this response
     * contains the last page of results.
     *
     * Generated from protobuf field string next_page_token = 2;
     * @param string $var
     * @return $this
     */
    public function setNextPageToken($var)
    {
        GPBUtil::checkString($var, True);
        $this->next_page_token = $var;

        return $this;
    }

}

redpajama_set_name: RedPajamaGithub


text:
from inc_cfg import *

test_param = TestParam(
		"Callee=optional (with duplicated offer) SRTP, caller=optional (with duplicated offer) SRTP",
		[
			InstanceParam("callee", "--null-audio --use-srtp=3 --srtp-secure=0 --max-calls=1"),
			InstanceParam("caller", "--null-audio --use-srtp=3 --srtp-secure=0 --max-calls=1")
		]
		)


text:
package com.vaadin.tests.components.treetable;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elements.TreeTableElement;
import com.vaadin.tests.tb3.MultiBrowserTest;

/**
 * Tests that TreeTable with ContainerHierarchicalWrapper is updated correctly
 * when the setParent() is called for the item just added
 *
 * @author Vaadin Ltd
 */
public class TreeTableContainerHierarchicalWrapperTest
        extends MultiBrowserTest {

    @Test
    public void testStructure() throws InterruptedException {
        openTestURL();

        TreeTableElement treeTable = $(TreeTableElement.class).first();
        WebElement findElement = treeTable.getCell(0, 0)
                .findElement(By.className("v-treetable-treespacer"));
        findElement.click();

        TestBenchElement cell = treeTable.getCell(5, 0);
        WebElement findElement2 = cell
                .findElement(By.className("v-treetable-treespacer"));
        assertEquals("Item 0-5", cell.getText());
        findElement2.click();

        TestBenchElement cell2 = treeTable.getCell(10, 0);
        assertEquals("Item 0-5-5", cell2.getText());
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>ish: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>

ish version 0.1

Simple Input handling middleware

Main Page

Namespaces

Classes

Files

Class List

Class Index

Class Hierarchy

Class Members

ish

ISH

ish::ISH Member List

This is the complete list of members for ish::ISH, including all inherited members.

GetInputValue(const char *name, PlayerIndexs playerIndex=PlayerOne)	ish::ISH	 [static]

Initialize(const char *fileName="keyConfig.ini", PlayerIndexs numberOfPlayers=PlayerMax)	ish::ISH	 [static]

LoadKeyData(const char *fileName, PlayerIndexs playerToApplySetting=PlayerOne)	ish::ISH	 [static]

SetInput(const char *fileName, const char *name, InputOption option, PlayerIndexs index, bool isPositive, SaveOption saveOption)	ish::ISH	 [static]

Shutdown(void)	ish::ISH	 [static]

Update(void)	ish::ISH	 [static]

<address class="footer">Generated on Thu Sep 1 2011 21:00:45 for ish by

 1.7.4 </address>


text:
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    QSplashScreen *splash = new QSplashScreen(QPixmap("/home/cesar/Git/appSignal/ucm.png"),Qt::WindowStaysOnTopHint | Qt::SplashScreen);
    splash->show();
    //splash->showMessage("Iniciando ventana principal ...");

    w.upOctave();
    //splash->showMessage("Cargando modulos ...", Qt::TopRightSection, Qt::white);
    //splash->showMessage("Estableciendo conexiones ...", Qt::AlignRight | Qt::AlignTop,Qt::white);
    QThread::sleep(5);

    w.show();
    splash->finish(&w);
    delete splash;

    return a.exec();
}


text:
package me.panpf.sketch.state;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import me.panpf.sketch.SketchView;
import me.panpf.sketch.drawable.SketchLoadingDrawable;
import me.panpf.sketch.drawable.SketchShapeBitmapDrawable;
import me.panpf.sketch.request.DisplayOptions;
import me.panpf.sketch.request.ShapeSize;
import me.panpf.sketch.shaper.ImageShaper;
import me.panpf.sketch.util.SketchUtils;

/**
 * 使用当前 {@link ImageView} 正在显示的图片作为状态图片
 */
public class OldStateImage implements StateImage {
    @Nullable
    private StateImage whenEmptyImage;

    public OldStateImage(@Nullable StateImage whenEmptyImage) {
        this.whenEmptyImage = whenEmptyImage;
    }

    public OldStateImage() {
    }

    @Nullable
    @Override
    public Drawable getDrawable(@NonNull Context context, @NonNull SketchView sketchView, @NonNull DisplayOptions displayOptions) {
        Drawable drawable = SketchUtils.getLastDrawable(sketchView.getDrawable());

        if (drawable instanceof SketchLoadingDrawable) {
            drawable = ((SketchLoadingDrawable) drawable).getWrappedDrawable();
        }

        if (drawable != null) {
            ShapeSize shapeSize = displayOptions.getShapeSize();
            ImageShaper imageShaper = displayOptions.getShaper();
            if (shapeSize != null || imageShaper != null) {
                if (drawable instanceof SketchShapeBitmapDrawable) {
                    drawable = new SketchShapeBitmapDrawable(context, ((SketchShapeBitmapDrawable) drawable).getBitmapDrawable(), shapeSize, imageShaper);
                } else if (drawable instanceof BitmapDrawable) {
                    drawable = new SketchShapeBitmapDrawable(context, (BitmapDrawable) drawable, shapeSize, imageShaper);
                }
            }
        }

        if (drawable == null && whenEmptyImage != null) {
            drawable = whenEmptyImage.getDrawable(context, sketchView, displayOptions);
        }

        return drawable;
    }
}


text:
class CreateOrganoDeGobiernos < ActiveRecord::Migration
  def change
    create_table :organo_de_gobiernos do |t|
      t.string :denominacion
      t.string :codigo

      t.timestamps null: false
    end
  end
end


text:
package com.insightfullogic.java8.examples.chapter9;

public class AlbumLookupException extends RuntimeException {

    public AlbumLookupException(Throwable cause) {
        super(cause);
    }

    public AlbumLookupException(String message) {
        super(message);
    }

}


text:
package com.cauchymop.goblob.presenter;

import com.cauchymop.goblob.model.GoGameController;

import org.jetbrains.annotations.NotNull;

public interface AchievementManager {
  void updateAchievements(@NotNull GoGameController goGameController);
}


text:
require 'addtion'

describe Addtion::Manip do
	it "returns addition result" do
		Addtion::Manip.add(2,3).should eq 5
	end
end


text:
require File.expand_path(File.dirname(__FILE__) + '/neo')

class AboutObjects < Neo::Koan
  def test_everything_is_an_object
    assert_equal 1.is_a?(Integer) && 1.is_a?(Numeric), 1.is_a?(Object)
    assert_equal 1.5.is_a?(Float) && 1.5.is_a?(Numeric), 1.5.is_a?(Object)
    assert_equal "string".is_a?(String), "string".is_a?(Object)
    assert_equal true, nil.is_a?(Object)
    assert_equal true, Object.is_a?(Object)
  end

  def test_objects_can_be_converted_to_strings
    assert_equal "123", 123.to_s
    assert_equal "", nil.to_s
  end

  def test_objects_can_be_inspected
    assert_equal "123", 123.inspect
    assert_equal "nil", nil.inspect
  end

  def test_every_object_has_an_id
    obj = Object.new
    assert_equal Fixnum, obj.object_id.class

  end

  def test_every_object_has_different_id
    obj = Object.new
    another_obj = Object.new
    assert_equal obj.object_id.is_a?(Fixnum) && another_obj.object_id.is_a?(Fixnum), obj.object_id != another_obj.object_id
  end

  def test_small_integers_have_fixed_ids
    assert_equal 1, 0.object_id
    assert_equal 3, 1.object_id
    assert_equal 5, 2.object_id
    assert_equal 201, 100.object_id

    # THINK ABOUT IT:
    # What pattern do the object IDs for small integers follow?
  end

  def test_clone_creates_a_different_object
    obj = Object.new
    copy = obj.clone

    assert_equal true, obj           != copy
    assert_equal true, obj.object_id != copy.object_id
  end
end


text:
"""Input gathering tool for SCons."""

import re
import SCons.Script

def GatherInputs(env, target, groups=['.*'], exclude_pattern=None):
  """Find all (non-generated) input files used for a target.

  Args:
    target: a target node to find source files for
      For example: File('bob.exe')
    groups: a list of patterns to use as categories
      For example: ['.*\\.c$', '.*\\.h$']
    exclude_pattern: a pattern to exclude from the search
      For example: '.*third_party.*'
  Returns:
     A list of lists of files for each category.
     Each file will be placed in the first category which matches,
     even if categories overlap.
     For example:
       [['bob.c', 'jim.c'], ['bob.h', 'jim.h']]
  """

  # Compile exclude pattern if any
  if exclude_pattern:
    exclude_pattern = re.compile(exclude_pattern)

  def _FindSources(ptrns, tgt, all):
    """Internal Recursive function to find all pattern matches."""
    # Recursively process lists
    if SCons.Util.is_List(tgt):
      for t in tgt:
        _FindSources(ptrns, t, all)
    else:
      # Get key to use for tracking whether we've seen this node
      target_abspath = None
      if hasattr(tgt, 'abspath'):
        # Use target's absolute path as the key
        target_abspath = tgt.abspath
        target_key = target_abspath
      else:
        # Hope node's representation is unique enough (the default repr
        # contains a pointer to the target as a string).  This works for
        # Alias() nodes.
        target_key = repr(tgt)

      # Skip if we have been here before
      if target_key in all: return
      # Note that we have been here
      all[target_key] = True
      # Skip ones that match an exclude pattern, if we have one.
      if (exclude_pattern and target_abspath
          and exclude_pattern.match(target_abspath)):
        return

      # Handle non-leaf nodes recursively
      lst = tgt.children(scan=1)
      if lst:
        _FindSources(ptrns, lst, all)
        return

      # Get real file (backed by repositories).
      rfile = tgt.rfile()
      rfile_is_file = rfile.isfile()
      # See who it matches
      for pattern, lst in ptrns.items():
        # Add files to the list for the first pattern that matches (implicitly,
        # don't add directories).
        if rfile_is_file and pattern.match(rfile.path):
          lst.append(rfile.abspath)
          break

  # Prepare a group for each pattern.
  patterns = {}
  for g in groups:
    patterns[re.compile(g, re.IGNORECASE)] = []

  # Do the search.
  _FindSources(patterns, target, {})

  return patterns.values()

def generate(env):
  # NOTE: SCons requires the use of this name, which fails gpylint.
  """SCons entry point for this tool."""

  # Add a method to gather all inputs needed by a target.
  env.AddMethod(GatherInputs, 'GatherInputs')


text:
"""Renders parse trees with Graphviz."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import base64
import warnings

import pygraphviz

def parse_tree_graph(sentence):
  """Constructs a parse tree graph.

  Args:
    sentence: syntaxnet.Sentence instance.

  Returns:
    HTML graph contents, as a string.
  """
  graph = pygraphviz.AGraph(directed=True, strict=False, rankdir="TB")

  for i, token in enumerate(sentence.token):
    node_id = "tok_{}".format(i)
    graph.add_node(node_id, label=token.word)
    if token.head >= 0:
      src_id = "tok_{}".format(token.head)
      graph.add_edge(
          src_id,
          node_id,
          label=token.label,
          key="parse_{}_{}".format(node_id, src_id))

  with warnings.catch_warnings():
    # Fontconfig spews some warnings, suppress them for now. (Especially because
    # they can clutter IPython notebooks).
    warnings.simplefilter("ignore")
    svg = graph.draw(format="svg", prog="dot")

  svg = unicode(svg, "utf-8")

  # For both inline and "new window" displays, we show the tokens with the
  # graph. (The sentence order of nodes is sometimes difficult to read.)
  image_and_text = u"
Text: {}
{}".format(" ".join(
      token.word for token in sentence.token), svg)

  # We generate a base64 URI. This is not too big, but older browsers may not
  # handle it well.
  new_window_html = (u""
                     + image_and_text).encode("utf-8")
  as_uri = "data:text/html;charset=utf-8;base64,{}".format(
      base64.b64encode(new_window_html))

  return u"{}
Open in new window
".format(
      image_and_text, as_uri)


text:
Accela::Configuration.app_id = "635395466279594650"
Accela::Configuration.app_secret = "3b1e4026d95e4478a0f8dd1f7a1b7028"
Accela::Configuration.agency = "islandton"
Accela::Configuration.environment = "TEST"


text:
package org.fugerit.java.core.web.servlet.config;

import java.util.Properties;

import org.apache.log4j.PropertyConfigurator;
import org.fugerit.java.core.cfg.ConfigException;
import org.fugerit.java.core.util.PropsIO;

public class Log4JConfig extends BasicConfig {

	/**
	 *
	 */
	private static final long serialVersionUID = 8238463428937400722L;

	public void configure(Properties props) throws ConfigException {
		this.getLogger().info( "configure start" );
		String configPath = props.getProperty( "log4j-config" );
		try {
			this.getLogger().info( "configure path : "+configPath );
			PropertyConfigurator.configure( PropsIO.loadFromStream( this.getConfigContext().resolveStream( configPath ) ) );
		} catch (Exception e) {
			throw ( new ConfigException( e ) );
		}
		this.getLogger().info( "configure [OK]" );
	}

}


text:
package com.dianping.cat.report.task.metric;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.unidal.helper.Files;

import com.dianping.cat.Cat;
import com.dianping.cat.alarm.rule.entity.Condition;
import com.dianping.cat.alarm.rule.entity.Config;
import com.dianping.cat.alarm.rule.entity.MonitorRules;
import com.dianping.cat.alarm.rule.entity.Rule;
import com.dianping.cat.alarm.rule.transform.DefaultSaxParser;
import com.dianping.cat.alarm.spi.rule.DataCheckEntity;
import com.dianping.cat.alarm.spi.rule.DataChecker;
import com.dianping.cat.alarm.spi.rule.DefaultDataChecker;

public class AlertConfigTest {

	private DataChecker m_checker = new DefaultDataChecker();

	private Map<String, List<com.dianping.cat.alarm.rule.entity.Config>> buildConfigMap(MonitorRules monitorRules) {
		if (monitorRules == null || monitorRules.getRules().size() == 0) {
			return null;
		}

		Map<String, List<com.dianping.cat.alarm.rule.entity.Config>> map = new HashMap<String, List<com.dianping.cat.alarm.rule.entity.Config>>();

		for (Rule rule : monitorRules.getRules().values()) {
			map.put(rule.getId(), rule.getConfigs());
		}

		return map;
	}

	private List<Condition> buildConditions(List<Config> configs) {
		List<Condition> conditions = new ArrayList<Condition>();

		for (Config config : configs) {
			conditions.addAll(config.getConditions());
		}

		return conditions;
	}

	private MonitorRules buildMonitorRuleFromFile(String path) {
		try {
			String content = Files.forIO().readFrom(this.getClass().getResourceAsStream(path), "utf-8");
			return DefaultSaxParser.parse(content);
		} catch (Exception ex) {
			Cat.logError(ex);
			return null;
		}
	}

	@Test
	public void testMinute() {
		Map<String, List<com.dianping.cat.alarm.rule.entity.Config>> configMap = buildConfigMap(
								buildMonitorRuleFromFile("/config/test-minute-monitor.xml"));

		Assert.assertNotNull(configMap);

		double baseline[] = { 50, 200, 200 };
		double value[] = { 50, 100, 100 };
		DataCheckEntity result = extractError(
								m_checker.checkData(value, baseline,	buildConditions(configMap.get("two-minute"))));
		Assert.assertEquals(result.isTriggered(), true);
	}

	@Test
	public void testRule() {
		Map<String, List<com.dianping.cat.alarm.rule.entity.Config>> configMap = buildConfigMap(
								buildMonitorRuleFromFile("/config/test-rule-monitor.xml"));

		Assert.assertNotNull(configMap);

		double baseline[] = { 200, 200 };
		double value[] = { 100, 100 };
		DataCheckEntity result = extractError(
								m_checker.checkData(value, baseline,	buildConditions(configMap.get("decreasePercentage"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline2 = { 200, 300 };
		double[] value2 = { 100, 100 };
		result = extractError(m_checker.checkData(value2, baseline2, buildConditions(configMap.get("decreaseValue"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline3 = { 200, 50 };
		double[] value3 = { 400, 100 };
		result = extractError(m_checker.checkData(value3, baseline3, buildConditions(configMap.get("increasePercentage"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline4 = { 200, 50 };
		double[] value4 = { 400, 100 };
		result = extractError(m_checker.checkData(value4, baseline4, buildConditions(configMap.get("increaseValue"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline5 = { 200, 200 };
		double[] value5 = { 500, 600 };
		result = extractError(m_checker.checkData(value5, baseline5, buildConditions(configMap.get("absoluteMaxValue"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline6 = { 200, 200 };
		double[] value6 = { 50, 40 };
		result = extractError(m_checker.checkData(value6, baseline6, buildConditions(configMap.get("absoluteMinValue"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline7 = { 200, 200 };
		double[] value7 = { 100, 100 };
		result = extractError(m_checker.checkData(value7, baseline7,	buildConditions(configMap.get("conditionCombination"))));
		Assert.assertEquals(result.isTriggered(), true);

		double[] baseline8 = { 200, 200 };
		double[] value8 = { 100, 100 };
		result = extractError(
								m_checker.checkData(value8, baseline8,	buildConditions(configMap.get("subconditionCombination"))));
		Assert.assertNull(result);
	}

	private DataCheckEntity extractError(List<DataCheckEntity> alertResults) {
		int length = alertResults.size();
		if (length == 0) {
			return null;
		}

		for (DataCheckEntity alertResult : alertResults) {
			if (alertResult.getAlertLevel().equals("error")) {
				return alertResult;
			}
		}

		return alertResults.get(length - 1);
	}
}


text:
#ifndef DragClient_h
#define DragClient_h

#include "core/page/DragActions.h"

namespace blink {

class DataTransfer;
class DragData;
class DragImage;
class LocalFrame;
class IntPoint;

class DragClient {
public:
    virtual DragDestinationAction actionMaskForDrag(DragData*) = 0;
    virtual void startDrag(DragImage*, const IntPoint& dragImageOrigin, const IntPoint& eventPos, DataTransfer*, LocalFrame*, bool linkDrag = false) = 0;
    virtual ~DragClient() { }
};

}

#endif // !DragClient_h


text:
storm-example
=============

Storm twitter hashtag count example written in python using petrel library.


text:
"""Unit tests for the cert module."""
# pylint: disable=missing-docstring

from __future__ import unicode_literals

import mock
import pytest

from tinycert.cert import CertificateApi
from tinycert.cert import State

@pytest.fixture(name='session')
def fixture_session():
    fixture = mock.MagicMock()
    fixture.request = mock.MagicMock()
    return fixture

@pytest.fixture(name='api')
def fixture_api(session):
    return CertificateApi(session)

def list_test(session, api):
    expected_list = [
        {'id': 123, 'name': 'test cert', 'status': 'good', 'expires': 987654321},
        {'id': 456, 'name': 'another test cert', 'status': 'revoked', 'expires': 987654322}
    ]
    session.request.return_value = expected_list

    result = api.list(555, State.good.value | State.revoked.value)
    assert result == expected_list
    session.request.assert_called_with('cert/list', {'ca_id': 555, 'what': 6})

def details_test(session, api):
    expected_result = {
        'id': 123,
        'status': 'good',
        'C': 'US',
        'ST': 'Washington',
        'L': 'Seattle',
        'O': 'Acme, Inc.',
        'OU': 'IT Department',
        'CN': 'Acme, Inc. CA',
        'Alt': [
            {'DNS': 'www.example.com'},
            {'DNS': 'example.com'}
        ],
        'hash_alg': 'SHA256'
    }
    session.request.return_value = expected_result

    result = api.details(123)
    assert result == expected_result
    session.request.assert_called_with('cert/details', {'cert_id': 123})

def get_test(session, api):
    expected_result = {
        'pem': ('-----BEGIN RSA PRIVATE KEY-----'
                'KEYMATERIALHERE...'
                '-----END RSA PRIVATE KEY-----')
    }
    session.request.return_value = expected_result

    result = api.get(123, 'key.dec')
    assert result == expected_result
    session.request.assert_called_with('cert/get', {'cert_id': 123, 'what': 'key.dec'})

def reissue_test(session, api):
    expected_result = {
        'cert_id': 456
    }
    session.request.return_value = expected_result

    result = api.reissue(123)
    assert result == expected_result
    session.request.assert_called_with('cert/reissue', {'cert_id': 123})

def set_status_test(session, api):
    session.request.return_value = {}
    result = api.set_status(123, 'hold')
    assert result == {}
    session.request.assert_called_with('cert/status', {'cert_id': 123, 'status': 'hold'})

def create_test(session, api):
    expected_result = {
        'cert_id': 456
    }
    session.request.return_value = expected_result

    create_detail = {
        'C': 'US',
        'CN': '*.example.com',
        'L': 'Seattle',
        'O': 'Acme, Inc.',
        'OU': 'IT Department',
        'SANs': [
            {'DNS': 'www.example.com'},
            {'DNS': 'example.com'}
        ],
        'ST': 'Washington'
    }
    expected_detail = create_detail.copy()
    expected_detail['ca_id'] = 123

    result = api.create(123, create_detail)
    assert result == expected_result
    session.request.assert_called_with('cert/new', expected_detail)


text:
package com.dd.bootstrap3.demo.components;

import com.webobjects.appserver.WOActionResults;
import com.webobjects.appserver.WOContext;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSMutableDictionary;

import er.extensions.components.ERXComponent;

/**
 * Base component for examples.
 * Serves as a data access container.
 *
 * @author robin
 */
public class ExampleComponent extends ERXComponent {

	public NSMutableDictionary<String, Object> exampleDict = new NSMutableDictionary<String, Object>();
	public boolean exampleSwitch;
	public NSArray<String> exampleSelections;
	public NSArray<String> exampleList = new NSArray<String>(new String[] {
			"First entry of many",
			"A second one",
			"Third entry is here",
			"Fourth one here",
			"I can write many more entries",
			"But I guess that enough",
			"For the very first time"
	});

	public ExampleComponent(WOContext context) {
		super(context);
	}

	public WOActionResults exampleAction() {
		return null;
	}

}


text:
<invoice>
  <amount type="decimal">20.0</amount>
  <client-id type="integer">8</client-id>
  <created-at type="datetime">2008-04-09T12:07:56Z</created-at>
  <currency>United States Dollars - USD</currency>
  <due-amount type="decimal">10.0</due-amount>
  <due-at type="date">2008-02-06</due-at>
  <due-at-human-format>due upon receipt</due-at-human-format>
  <id type="integer">1</id>
  <issued-at type="date">2008-02-06</issued-at>
  <notes>Some notes go here</notes>
  <number>100001</number>
  <period-end type="date">2008-03-31</period-end>
  <period-start type="date">2007-06-26</period-start>
  <purchase-order nil="true"></purchase-order>
  <client-key>f2a56b1232ad1asdf5926f040e8cff2befb5e8f1</client-key>
  <!-- See invoice messages and invoice payments for manipulating the
   state attribute.  Direct assigment will be ignored. -->
  <state>draft</state>
  <updated-at type="datetime">2008-04-09T12:07:56Z</updated-at>
  <created-at type="datetime">2008-04-09T12:07:56Z</created-at>
  <!-- Line items in CSV format -->
  <csv-line-items>
kind,description,quantity,unit_price,amount,taxed,taxed2,project_id
Service,Security support / Apply upgrades,0.68,80.00,54.4,true,false,3
Service,Security support / Intrusion detection,0.57,80.00,45.6,true,false,3
Service,Backend Programming / Forum admin,1.20,80.00,96.0,true,false,3
  </csv-line-items>
  <!-- applied a 10% tax on all line items marked as taxed -->
  <tax type="decimal">10</tax>
  <!-- no second tax -->
  <tax2 type="decimal" nil="true"></tax2>
  <!-- tax amount -->
  <tax-amount type="decimal">23.04</tax-amount>
  <tax2-amount type="decimal" nil="true">0</tax2-amount>
</invoice>


text:
using System;
using System.Linq.Expressions;

namespace NonFactors.Mvc.Grid
{
    public interface IGridFilter
    {
        String? Method { get; set; }
        String?[] Values { get; set; }

        Expression? Apply(Expression expression);
    }
}


text:
package org.kie.workbench.common.forms.jbpm.server.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.assertj.core.api.Assertions;
import org.eclipse.bpmn2.Definitions;
import org.jbpm.bpmn2.handler.WorkItemHandlerRuntimeException;
import org.jbpm.simulation.util.BPMN2Utils;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.kie.workbench.common.forms.jbpm.model.authoring.AbstractJBPMFormModel;
import org.kie.workbench.common.forms.jbpm.model.authoring.process.BusinessProcessFormModel;
import org.kie.workbench.common.forms.jbpm.model.authoring.task.TaskFormModel;
import org.kie.workbench.common.forms.jbpm.service.bpmn.util.BPMNVariableUtils;
import org.kie.workbench.common.forms.model.ModelProperty;
import org.kie.workbench.common.services.backend.project.ModuleClassLoaderHelper;
import org.kie.workbench.common.services.shared.project.KieModule;
import org.kie.workbench.common.services.shared.project.KieModuleService;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.uberfire.backend.vfs.Path;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class BPMNFormModelGeneratorImplTest {

    private static final String
            PROJECT_NAME = "myProject",
            RESOURCES_PATH = "/definitions/",
            BPMN2_SUFFIX = ".bpmn2",
            PROCESS_WITHOUT_VARIABLES_NAME = "process-without-variables",
            PROCESS_WITH_ALL_VARIABLES_NAME = "process-with-all-possible-variables",
            PROCESS_WITH_WRONG_TYPES = "process-with-wrong-types",
            PROCESS_WITH_SHARED_FORMS_NAME = "process-with-tasks-sharing-forms",
            PROCESS_WITH_SHARED_FORMS_WRONG_MAPPINGS_NAME = "process-with-tasks-sharing-forms-with-wrong-mapping",
            PROCESS_WITH_SHARED_FORMS_ID = "myProject.processTaskSharedForms",
            PROCESS_WITH_SHARED_FORMS_WRONG_MAPPINGS_ID = "myProject.processTaskSharedFormsWrongMappings",
            PROCESS_WITH_ALL_VARIABLES_ID = PROJECT_NAME + "." + PROCESS_WITH_ALL_VARIABLES_NAME,
            DATA_OBJECT_TYPE = "com.myteam.myproject.Person", // Selected from list of known data object types in Designer variable editor
            CUSTOM_TYPE = "com.test.MyType"; //Entered into the variable type declaration as naked String

    private static final Map<String, String> EXPECTED_INPUT_VARIABLES = new HashMap<String, String>() {{
        put("_string",
            String.class.getName());
        put("_integer",
            Integer.class.getName());
        put("_boolean",
            Boolean.class.getName());
        put("_float",
            Float.class.getName());
        put("_object",
            Object.class.getName());
        put("_dataObject",
            DATA_OBJECT_TYPE);
        put("_customType",
            CUSTOM_TYPE);
        put("_list",
            Object.class.getName());
    }};

    private static final Map<String, String> EXPECTED_OUTPUT_VARIABLES = new HashMap<String, String>() {{
        put("string_",
            String.class.getName());
        put("integer_",
            Integer.class.getName());
        put("boolean_",
            Boolean.class.getName());
        put("float_",
            Float.class.getName());
        put("object_",
            Object.class.getName());
        put("dataObject_",
            DATA_OBJECT_TYPE);
        put("customType_",
            CUSTOM_TYPE);
        put("list_",
            Object.class.getName());
    }};
    private static BPMNFormModelGeneratorImpl generator;
    private static Definitions
            processWithoutVariablesDefinitions,
            processWithAllVariablesDefinitions,
            processWithSharedForms,
            processWithSharedFormsWrongMappings,
            processWithWrongTypes;
    @Mock
    private Path path;
    @Mock
    private KieModuleService projectService;
    @Mock
    private KieModule module;
    @Mock
    private ModuleClassLoaderHelper projectClassLoaderHelper;
    @Mock
    private ClassLoader projectClassLoader;

    @BeforeClass
    public static void setUp() throws Exception {
        processWithoutVariablesDefinitions = BPMN2Utils.getDefinitions(BPMNFormModelGeneratorImplTest.class.getResourceAsStream(RESOURCES_PATH + PROCESS_WITHOUT_VARIABLES_NAME + BPMN2_SUFFIX));
        processWithAllVariablesDefinitions = BPMN2Utils.getDefinitions(BPMNFormModelGeneratorImplTest.class.getResourceAsStream(RESOURCES_PATH + PROCESS_WITH_ALL_VARIABLES_NAME + BPMN2_SUFFIX));
        processWithSharedForms = BPMN2Utils.getDefinitions(BPMNFormModelGeneratorImplTest.class.getResourceAsStream(RESOURCES_PATH + PROCESS_WITH_SHARED_FORMS_NAME + BPMN2_SUFFIX));
        processWithSharedFormsWrongMappings = BPMN2Utils.getDefinitions(BPMNFormModelGeneratorImplTest.class.getResourceAsStream(RESOURCES_PATH + PROCESS_WITH_SHARED_FORMS_WRONG_MAPPINGS_NAME + BPMN2_SUFFIX));
        processWithWrongTypes  = BPMN2Utils.getDefinitions(BPMNFormModelGeneratorImplTest.class.getResourceAsStream(RESOURCES_PATH + PROCESS_WITH_WRONG_TYPES + BPMN2_SUFFIX));
    }

    @Before
    public void init() throws Exception {
        when(projectService.resolveModule(any())).thenReturn(module);
        when(module.getRootPath()).thenReturn(path);
        when(projectClassLoaderHelper.getModuleClassLoader(module)).thenReturn(projectClassLoader);
        when(projectClassLoader.loadClass(anyString())).thenAnswer(invocation -> Object.class);

        generator = new BPMNFormModelGeneratorImpl(projectService,
                                                   projectClassLoaderHelper);
    }

    @Test
    public void testGenerateAllForProcessWithoutProcessVariables() {
        //generate all = generateProcessFormModel + generateTaskFormModels
        BusinessProcessFormModel processFormModel = generator.generateProcessFormModel(processWithoutVariablesDefinitions,
                                                                                path);
        assertProcessFormModelFieldsAreCorrect(processFormModel,
                                               PROCESS_WITHOUT_VARIABLES_NAME);
        assertTrue(processFormModel.getProperties().isEmpty());

        List<TaskFormModel> taskFormModels = generator.generateTaskFormModels(processWithoutVariablesDefinitions,
                                                                              path);
        assertTrue(taskFormModels.isEmpty());
    }

    @Test
    public void testGenerateAllForProcessWithAllPossibleProcessVariables() {
        final Map<String, String> EXPECTED_PROCESS_VARIABLES = new HashMap<String, String>() {{
            put("string",
                String.class.getName());
            put("integer",
                Integer.class.getName());
            put("boolean",
                Boolean.class.getName());
            put("float",
                Float.class.getName());
            put("object",
                Object.class.getName());
            put("dataObject",
                DATA_OBJECT_TYPE);
            put("customType",
                CUSTOM_TYPE);
            put("list", Object.class.getName());
        }};

        //generate all = generateProcessFormModel + generateTaskFormModels
        BusinessProcessFormModel processFormModel = generator.generateProcessFormModel(processWithAllVariablesDefinitions,
                                                                                path);
        assertProcessFormModelFieldsAreCorrect(processFormModel,
                                               PROCESS_WITH_ALL_VARIABLES_NAME);
        assertJBPMVariablesAreCorrect(processFormModel,
                                      EXPECTED_PROCESS_VARIABLES);

        List<TaskFormModel> taskFormModels = generator.generateTaskFormModels(processWithAllVariablesDefinitions,
                                                                              path);
        final int EXPECTED_NUMBER_OF_HUMAN_TASKS = 5; // taskOnlyWithOutputs-taskform, emptyTask-taskform, taskOnlyWithInputs-taskform, taskWithDifferentInputsAndOutputs-taskform, taskWithTheSameInputsAndOutputs-taskform
        assertEquals("Forms should be generated for all human tasks including tasks in subprocesses and swimlanes",
                     EXPECTED_NUMBER_OF_HUMAN_TASKS,
                     taskFormModels.size());
    }

    @Test
    public void testCorrectTaskFormModelIsGeneratedForTaskWithoutAnyInputsOrOutputsInSwimlane() {
        final String
                TASK_ID = "_23BBA464-615A-405F-8C3B-4F643BE522D6",
                TASK_NAME = "emptyTask";

        TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions,
                                                                      TASK_ID,
                                                                      path);
        assertTaskFormModelIsCorrect(taskFormModel,
                                     PROCESS_WITH_ALL_VARIABLES_ID,
                                     TASK_NAME);
        assertTrue(taskFormModel.getProperties().isEmpty());
    }

    @Test
    public void testCorrectTaskFormModelIsGeneratedForTaskWithDifferentInputsAndOutputsInAdHocSubprocess() {
        final String
                TASK_ID = "_D3B8EE8F-5402-408D-815D-FFE1BAD943D9",
                TASK_NAME = "taskWithDifferentInputsAndOutputs";
        final Map<String, String> EXPECTED_TASK_VARIABLES = new HashMap<String, String>() {{
            putAll(EXPECTED_INPUT_VARIABLES);
            putAll(EXPECTED_OUTPUT_VARIABLES);
        }};

        TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions,
                                                                      TASK_ID,
                                                                      path);
        assertTaskFormModelIsCorrect(taskFormModel,
                                     PROCESS_WITH_ALL_VARIABLES_ID,
                                     TASK_NAME);
        assertJBPMVariablesAreCorrect(taskFormModel,
                                      EXPECTED_TASK_VARIABLES);
    }

    @Test
    public void testCorrectTaskFormModelIsGeneratedForTaskWithTheInputsAndOutputsBoundToTheSameNamesInSwimlane() {
        final String TASK_ID = "_9903B013-C42D-486B-A41D-2DEBC60911E3",
                TASK_NAME = "taskWithTheSameInputsAndOutputs";

        final Map<String, String> EXPECTED_TASK_VARIABLES = new HashMap<String, String>() {{
            put("_string_", String.class.getName());
            put("_integer_", Integer.class.getName());
            put("_boolean_", Boolean.class.getName());
            put("_float_", Float.class.getName());
            put("_object_", Object.class.getName());
            put("_dataObject_", DATA_OBJECT_TYPE);
            put("_customType_", CUSTOM_TYPE);
            put("_list_", Object.class.getName());
        }};

        TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions,
                                                                      TASK_ID,
                                                                      path);
        assertTaskFormModelIsCorrect(taskFormModel,
                                     PROCESS_WITH_ALL_VARIABLES_ID,
                                     TASK_NAME);
        assertJBPMVariablesAreCorrect(taskFormModel,
                                      EXPECTED_TASK_VARIABLES);
    }

    @Test
    public void testCorrectTaskFormModelIsGeneratedForTaskThatContainsOnlyInputs() {
        final String TASK_ID = "_9F3A7665-E7EF-4DC2-94F1-F9D20A38547E",
                TASK_NAME = "taskOnlyWithInputs";
        TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions,
                                                                      TASK_ID,
                                                                      path);
        assertTaskFormModelIsCorrect(taskFormModel,
                                     PROCESS_WITH_ALL_VARIABLES_ID,
                                     TASK_NAME);
        assertJBPMVariablesAreCorrect(taskFormModel,
                                      EXPECTED_INPUT_VARIABLES);
    }

    @Test
    public void testCorrectTaskFormModelIsGeneratedForTaskThatContainsOnlyOutputsInEmbeddedSubprocess() {
        final String
                TASK_ID = "_9E9EAE16-F9F4-49D0-854D-0D2C8CB9382F",
                TASK_NAME = "taskOnlyWithOutputs";

        TaskFormModel taskFormModel = generator.generateTaskFormModel(processWithAllVariablesDefinitions,
                                                                      TASK_ID,
                                                                      path);
        assertTaskFormModelIsCorrect(taskFormModel,
                                     PROCESS_WITH_ALL_VARIABLES_ID,
                                     TASK_NAME);
        assertJBPMVariablesAreCorrect(taskFormModel,
                                      EXPECTED_OUTPUT_VARIABLES);
    }

    @Test
    public void testGenerateTaskFormModelForTaskWithSharedForm() {
        final String[] TASK_IDS = new String[]{"_77BDDEC9-0D5E-4C46-8AD6-1B528836A22B", "_C976E341-8E35-42C7-B878-67049CE63E5F", "_27F23135-87E9-47C5-9B97-DA793699E8CF"};
        final String TASK_NAME = "task";

        TaskFormModel[] generatedModels = new TaskFormModel[TASK_IDS.length];

        for (int i = 0; i < TASK_IDS.length; i++) {
            generatedModels[i] = generator.generateTaskFormModel(processWithSharedForms,
                                                                 TASK_IDS[i],
                                                                 path);
            assertNotNull(generatedModels[i]);
            assertTaskFormModelIsCorrect(generatedModels[i],
                                         PROCESS_WITH_SHARED_FORMS_ID,
                                         TASK_NAME);
            checkExpectedMergedFormVariables(generatedModels[i]);
        }
    }

    @Test
    public void testGenerateAllTaskFormModelForTasksWithSharedForm() {
        final String TASK_NAME = "task";

        final int EXPECTED_MODELS = 2;

        List<TaskFormModel> generatedModels = generator.generateTaskFormModels(processWithSharedForms,
                                                                               path);

        assertNotNull(generatedModels);

        assertEquals(EXPECTED_MODELS,
                     generatedModels.size());

        for (TaskFormModel formModel : generatedModels) {
            assertNotNull(formModel);
            assertEquals(PROCESS_WITH_SHARED_FORMS_ID,
                         formModel.getProcessId());
            assertNotNull(formModel.getProperties());
            assertFalse(formModel.getProperties().isEmpty());
            if (formModel.getFormName().equals(TASK_NAME + BPMNVariableUtils.TASK_FORM_SUFFIX)) {
                checkExpectedMergedFormVariables(formModel);
            }
        }
    }

    @Test
    public void testGenerateTaskFormModelForTaskWithSharedFormWithWrongMappings() {

        final String[] TASK_IDS = new String[]{"_77BDDEC9-0D5E-4C46-8AD6-1B528836A22B", "_C976E341-8E35-42C7-B878-67049CE63E5F", "_27F23135-87E9-47C5-9B97-DA793699E8CF"};

        int count = 0;

        for (int i = 0; i < TASK_IDS.length; i++) {
            try {
                generator.generateTaskFormModel(processWithSharedFormsWrongMappings,
                                                TASK_IDS[i],
                                                path);

                fail("We shouldn't be here, the form generation should break!");
            } catch (Exception ex) {
                count++;
            }
        }

        assertEquals(TASK_IDS.length,
                     count);
    }

    @Test
    public void testGenerateAllTaskFormModelForTasksWithSharedFormWithWrongMappings() {
        final String TASK_NAME = "task";

        final int EXPECTED_MODELS = 1;

        List<TaskFormModel> generatedModels = generator.generateTaskFormModels(processWithSharedFormsWrongMappings,
                                                                               path);

        assertNotNull(generatedModels);

        assertEquals(EXPECTED_MODELS,
                     generatedModels.size());

        for (TaskFormModel formModel : generatedModels) {
            assertNotNull(formModel);
            assertEquals(PROCESS_WITH_SHARED_FORMS_WRONG_MAPPINGS_ID,
                         formModel.getProcessId());
            assertNotNull(formModel.getProperties());
            assertFalse(formModel.getProperties().isEmpty());
            assertNotEquals(TASK_NAME + BPMNVariableUtils.TASK_FORM_SUFFIX,
                            formModel.getFormName());
        }
    }

    @Test
    public void testGenerateAllWithWrongTypes() throws Exception {
        when(projectClassLoader.loadClass(anyString())).thenAnswer(invocationOnMock -> getClass().getClassLoader().loadClass(invocationOnMock.getArguments()[0].toString()));

        final Map<String, String> EXPECTED_PROPERTIES = new HashMap<String, String>() {{
            put("name", String.class.getName());
            put("age", Integer.class.getName());
            put("error", WorkItemHandlerRuntimeException.class.getName());
            put("list", Object.class.getName());
        }};

        BusinessProcessFormModel processFormModel = generator.generateProcessFormModel(processWithWrongTypes, path);

        assertProcessFormModelFieldsAreCorrect(processFormModel, PROCESS_WITH_WRONG_TYPES);

        Assertions.assertThat(processFormModel.getProperties())
                .isNotNull()
                .isNotEmpty()
                .hasSize(EXPECTED_PROPERTIES.size());

        assertEquals(EXPECTED_PROPERTIES.size(), processFormModel.getProperties().size());
        assertJBPMVariablesAreCorrect(processFormModel, EXPECTED_PROPERTIES);

        List<TaskFormModel> taskFormModels = generator.generateTaskFormModels(processWithWrongTypes,
                                                                              path);
        final int EXPECTED_NUMBER_OF_HUMAN_TASKS = 1;

        Assertions.assertThat(taskFormModels)
                .isNotNull()
                .isNotEmpty()
                .hasSize(EXPECTED_NUMBER_OF_HUMAN_TASKS);

        TaskFormModel taskFormModel = taskFormModels.get(0);

        Assertions.assertThat(taskFormModel.getProperties())
                .isNotNull()
                .isNotEmpty()
                .hasSize(EXPECTED_PROPERTIES.size());

        assertJBPMVariablesAreCorrect(taskFormModel, EXPECTED_PROPERTIES);
    }

    protected void checkExpectedMergedFormVariables(TaskFormModel formModel) {
        final Map<String, String> EXPECTED_TYPES = new HashMap<>();
        EXPECTED_TYPES.put("name",
                           String.class.getName());
        EXPECTED_TYPES.put("lastName",
                           String.class.getName());
        EXPECTED_TYPES.put("age",
                           Integer.class.getName());
        EXPECTED_TYPES.put("married",
                           Boolean.class.getName());

        assertEquals(EXPECTED_TYPES.size(),
                     formModel.getProperties().size());
        for (ModelProperty property : formModel.getProperties()) {
            assertNotNull(EXPECTED_TYPES.get(property.getName()));
            assertEquals(EXPECTED_TYPES.get(property.getName()),
                         property.getTypeInfo().getClassName());
        }
    }

    private void assertProcessFormModelFieldsAreCorrect(BusinessProcessFormModel formModel,
                                                        String processName) {
        final String PROCESS_ID = PROJECT_NAME + "." + processName;
        assertEquals(PROCESS_ID,
                     formModel.getProcessId());
        assertEquals(processName,
                     formModel.getProcessName());
    }

    private void assertJBPMVariablesAreCorrect(AbstractJBPMFormModel formModel,
                                               Map<String, String> expectedVariables) {
        Map<String, String> actualVariables = new HashMap<>();
        for (ModelProperty modelProperty : formModel.getProperties()) {
            actualVariables.put(modelProperty.getName(), modelProperty.getTypeInfo().getClassName());
        }
        assertEquals(expectedVariables, actualVariables);
    }

    private void assertTaskFormModelIsCorrect(TaskFormModel taskFormModel,
                                              String processId,
                                              String taskName) {
        assertEquals(processId,
                     taskFormModel.getProcessId());

        final String EXPECTED_FORM_NAME = taskName + BPMNVariableUtils.TASK_FORM_SUFFIX;
        assertEquals(EXPECTED_FORM_NAME,
                     taskFormModel.getFormName());
    }
}


text:
package fj.control.db;

import fj.F;
import fj.Function;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.concurrent.Callable;

/**
 * The DB monad represents a database action, or a value within the context of a database connection.
 */
public abstract class DB<A> {

  /**
   * Executes the database action, given a database connection.
   *
   * @param c The connection against which to execute the action.
   * @return The result of the action.
   * @throws SQLException if a database error occurred.
   */
  public abstract A run(final Connection c) throws SQLException;

  /**
   * Constructs a database action as a function from a database connection to a value.
   *
   * @param f A function from a database connection to a value.
   * @return A database action representing the given function.
   */
  public static <A> DB<A> db(final F<Connection, A> f) {
    return new DB<A>() {
      public A run(final Connection c) {
        return f.f(c);
      }
    };
  }

  /**
   * Returns the callable-valued function projection of this database action.
   *
   * @return The callable-valued function which is isomorphic to this database action.
   */
  public final F<Connection, Callable<A>> asFunction() {
    return new F<Connection, Callable<A>>() {
      public Callable<A> f(final Connection c) {
        return new Callable<A>() {
          public A call() throws Exception {
            return run(c);
          }
        };
      }
    };
  }

  /**
   * Map a function over the result of this action.
   *
   * @param f The function to map over the result.
   * @return A new database action that applies the given function to the result of this action.
   */
  public final <B> DB<B> map(final F<A, B> f) {
    return new DB<B>() {
      public B run(final Connection c) throws SQLException {
        return f.f(DB.this.run(c));
      }
    };
  }

  /**
   * Promotes any given function so that it transforms between values in the database.
   *
   * @param f The function to promote.
   * @return A function equivalent to the given one, which operates on values in the database.
   */
  public static <A, B> F<DB<A>, DB<B>> liftM(final F<A, B> f) {
    return new F<DB<A>, DB<B>>() {
      public DB<B> f(final DB<A> a) {
        return a.map(f);
      }
    };
  }

  /**
   * Constructs a database action that returns the given value completely intact.
   *
   * @param a A value to be wrapped in a database action.
   * @return A new database action that returns the given value.
   */
  public static <A> DB<A> unit(final A a) {
    return new DB<A>() {
      public A run(final Connection c) {
        return a;
      }
    };
  }

  /**
   * Binds the given action across the result of this database action.
   *
   * @param f The function to bind across the result of this database action.
   * @return A new database action equivalent to applying the given function to the result of this action.
   */
  public final <B> DB<B> bind(final F<A, DB<B>> f) {
    return new DB<B>() {
      public B run(final Connection c) throws SQLException {
        return f.f(DB.this.run(c)).run(c);
      }
    };
  }

  /**
   * Removes one layer of monadic structure.
   *
   * @param a A database action that results in another.
   * @return A new database action equivalent to the result of the given action.
   */
  public static <A> DB<A> join(final DB<DB<A>> a) {
    return a.bind(Function.<DB<A>>identity());
  }
}


text:
import { LookupTree, LookupTreeEntry } from './types.js';

/**
 * Merges the provided trees into a single lookup tree. When conflicting lookups
 * are encountered between two trees, the one with the lower index, then the
 * lower subindex is chosen.
 *
 * @param trees Array of trees to merge. Entries in earlier trees are favored
 *              over those in later trees when there is a choice.
 */
export function mergeTrees(trees: LookupTree[]): LookupTree {
  const result: LookupTree = {
    individual: new Map<number, LookupTreeEntry>(),
    range: []
  };

  for (const tree of trees) {
    mergeSubtree(result, tree);
  }

  return result;
}

/**
 * Recursively merges the data for the mergeTree into the mainTree.
 *
 * @param mainTree The tree where the values should be merged
 * @param mergeTree The tree to be merged into the mainTree
 */
function mergeSubtree(mainTree: LookupTree, mergeTree: LookupTree): void {
  // Need to fix this recursively (and handle lookups)
  const allEntries = mergeTree.individual.entries();
  for (const [glyphId, value] of allEntries) {
    // The main tree is guaranteed to have no overlaps between the
    // individual and range values, so if we match an invididual, there
    // must not be a range
    if (mainTree.individual.get(glyphId)) {
      mergeTreeEntry(mainTree.individual.get(glyphId), value);
    } else {
      let matched = false;
      for (const [index, { range, entry }] of mainTree.range.entries()) {
        const overlap = getIndividualOverlap(Number(glyphId), range);

        // Don't overlap
        if (overlap.both === null) {
          continue;
        }

        matched = true;

        // If they overlap, we have to split the range and then
        // merge the overlap
        mainTree.individual.set(glyphId, value);
        mergeTreeEntry(mainTree.individual.get(glyphId), cloneEntry(entry));

        // When there's an overlap, we also have to fix up the range
        // that we had already processed
        mainTree.range.splice(index, 1);
        for (const glyph of overlap.second) {
          if (Array.isArray(glyph)) {
            mainTree.range.push({
              range: glyph,
              entry: cloneEntry(entry)
            });
          } else {
            mainTree.individual.set(glyph, cloneEntry(entry));
          }
        }
      }

      if (!matched) {
        mainTree.individual.set(glyphId, value);
      }
    }
  }

  for (const { range, entry } of mergeTree.range) {
    // Ranges are more complicated, because they can overlap with
    // multiple things, individual and range alike. We start by
    // eliminating ranges that are already present in another range
    let remainingRanges: (number | [number, number])[] = [range];

    for (let index = 0; index < mainTree.range.length; index++) {
      const { range, entry: resultEntry } = mainTree.range[index];
      for (const [remainingIndex, remainingRange] of remainingRanges.entries()) {
        if (Array.isArray(remainingRange)) {
          const overlap = getRangeOverlap(remainingRange, range);
          if (overlap.both === null) {
            continue;
          }

          mainTree.range.splice(index, 1);
          index--;

          const entryToMerge: LookupTreeEntry = cloneEntry(resultEntry);
          if (Array.isArray(overlap.both)) {
            mainTree.range.push({
              range: overlap.both,
              entry: entryToMerge
            });
          } else {
            mainTree.individual.set(overlap.both, entryToMerge);
          }

          mergeTreeEntry(entryToMerge, cloneEntry(entry));

          for (const second of overlap.second) {
            if (Array.isArray(second)) {
              mainTree.range.push({
                range: second,
                entry: cloneEntry(resultEntry)
              });
            } else {
              mainTree.individual.set(second, cloneEntry(resultEntry));
            }
          }

          remainingRanges = overlap.first;
        } else {
          const overlap = getIndividualOverlap(remainingRange, range);
          if (overlap.both === null) {
            continue;
          }

          // If they overlap, we have to split the range and then
          // merge the overlap
          mainTree.individual.set(remainingRange, cloneEntry(entry));
          mergeTreeEntry(mainTree.individual.get(remainingRange), cloneEntry(resultEntry));

          // When there's an overlap, we also have to fix up the range
          // that we had already processed
          mainTree.range.splice(index, 1);
          index--;

          for (const glyph of overlap.second) {
            if (Array.isArray(glyph)) {
              mainTree.range.push({
                range: glyph,
                entry: cloneEntry(resultEntry)
              });
            } else {
              mainTree.individual.set(glyph, cloneEntry(resultEntry));
            }
          }

          remainingRanges.splice(remainingIndex, 1, ...overlap.first);
          break;
        }
      }
    }

    // Next, we run the same against any individual glyphs
    for (const glyphId of mainTree.individual.keys()) {
      for (const [remainingIndex, remainingRange] of remainingRanges.entries()) {
        if (Array.isArray(remainingRange)) {
          const overlap = getIndividualOverlap(Number(glyphId), remainingRange);
          if (overlap.both === null) {
            continue;
          }

          // If they overlap, we have to merge the overlap
          mergeTreeEntry(mainTree.individual.get(glyphId), cloneEntry(entry));

          // Update the remaining ranges
          remainingRanges.splice(remainingIndex, 1, ...overlap.second);
          break;
        } else {
          if (Number(glyphId) === remainingRange) {
            mergeTreeEntry(mainTree.individual.get(glyphId), cloneEntry(entry));
            break;
          }
        }
      }
    }

    // Any remaining ranges should just be added directly
    for (const remainingRange of remainingRanges) {
      if (Array.isArray(remainingRange)) {
        mainTree.range.push({
          range: remainingRange,
          entry: cloneEntry(entry)
        });
      } else {
        mainTree.individual.set(remainingRange, cloneEntry(entry));
      }
    }
  }
}

/**
 * Recursively merges the entry forr the mergeTree into the mainTree
 *
 * @param mainTree The entry where the values should be merged
 * @param mergeTree The entry to merge into the mainTree
 */
function mergeTreeEntry(mainTree: LookupTreeEntry, mergeTree: LookupTreeEntry): void {
  if (
    mergeTree.lookup && (
      !mainTree.lookup ||
      mainTree.lookup.index > mergeTree.lookup.index ||
      (mainTree.lookup.index === mergeTree.lookup.index && mainTree.lookup.subIndex > mergeTree.lookup.subIndex)
    )
  ) {
    mainTree.lookup = mergeTree.lookup;
  }

  if (mergeTree.forward) {
    if (!mainTree.forward) {
      mainTree.forward = mergeTree.forward;
    } else {
      mergeSubtree(mainTree.forward, mergeTree.forward);
    }
  }

  if (mergeTree.reverse) {
    if (!mainTree.reverse) {
      mainTree.reverse = mergeTree.reverse;
    } else {
      mergeSubtree(mainTree.reverse, mergeTree.reverse);
    }
  }
}

interface Overlap {
  first: (number | [number, number])[];
  second: (number | [number, number])[];
  both: number | [number, number] | null;
}

/**
 * Determines the overlap (if any) between two ranges. Returns the distinct
 * ranges for each range and the overlap (if any).
 *
 * @param first First range
 * @param second Second range
 */
function getRangeOverlap(first: [number, number], second: [number, number]): Overlap {
  const result: Overlap = {
    first: [],
    second: [],
    both: null
  };

  // Both
  if (first[0] < second[1] && second[0] < first[1]) {
    const start = Math.max(first[0], second[0]);
    const end = Math.min(first[1], second[1]);
    result.both = rangeOrIndividual(start, end);
  }

  // Before
  if (first[0] < second[0]) {
    const start = first[0];
    const end = Math.min(second[0], first[1]);
    result.first.push(rangeOrIndividual(start, end));
  } else if (second[0] < first[0]) {
    const start = second[0];
    const end = Math.min(second[1], first[0]);
    result.second.push(rangeOrIndividual(start, end));
  }

  // After
  if (first[1] > second[1]) {
    const start = Math.max(first[0], second[1]);
    const end = first[1];
    result.first.push(rangeOrIndividual(start, end));
  } else if (second[1] > first[1]) {
    const start = Math.max(first[1], second[0]);
    const end = second[1];
    result.second.push(rangeOrIndividual(start, end));
  }

  return result;
}

/**
 * Determines the overlap (if any) between the individual glyph and the range
 * provided. Returns the glyphs and/or ranges that are unique to each provided
 * and the overlap (if any).
 *
 * @param first Individual glyph
 * @param second Range
 */
function getIndividualOverlap(first: number, second: [number, number]): Overlap {
  // Disjoint
  if (first < second[0] || first > second[1]) {
    return {
      first: [first],
      second: [second],
      both: null
    };
  }

  const result: Overlap = {
    first: [],
    second: [],
    both: first
  };

  if (second[0] < first) {
    result.second.push(rangeOrIndividual(second[0], first));
  }

  if (second[1] > first) {
    result.second.push(rangeOrIndividual(first + 1, second[1]));
  }

  return result;
}

/**
 * Returns an individual glyph if the range is of size one or a range if it is
 * larger.
 *
 * @param start Beginning of the range (inclusive)
 * @param end End of the range (exclusive)
 */
function rangeOrIndividual(start: number, end: number): number | [number, number] {
  if (end - start === 1) {
    return start;
  } else {
    return [start, end];
  }
}

/**
 * Clones an individual lookup tree entry.
 *
 * @param entry Lookup tree entry to clone
 */
function cloneEntry(entry: LookupTreeEntry): LookupTreeEntry {
  const result: LookupTreeEntry = {};

  if (entry.forward) {
    result.forward = cloneTree(entry.forward);
  }

  if (entry.reverse) {
    result.reverse = cloneTree(entry.reverse);
  }

  if (entry.lookup) {
    result.lookup = {
      contextRange: entry.lookup.contextRange.slice() as [number, number],
      index: entry.lookup.index,
      length: entry.lookup.length,
      subIndex: entry.lookup.subIndex,
      substitutions: entry.lookup.substitutions.slice()
    };
  }

  return result;
}

/**
 * Clones a lookup tree.
 *
 * @param tree Lookup tree to clone
 */
function cloneTree(tree: LookupTree): LookupTree {
  const individual = new Map<number, LookupTreeEntry>();
  for (const [glyphId, entry] of tree.individual.entries()) {
    individual.set(glyphId, cloneEntry(entry));
  }

  return {
    individual,
    range: tree.range.map(({ range, entry }) => ({
      range: range.slice() as [number, number],
      entry: cloneEntry(entry)
    }))
  };
}


text:
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/isteps/istep08/call_proc_init_ioppe.C $               */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2020                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* 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.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/**
 *  @file call_proc_init_ioppe.C
 *
 *  Support file for IStep: proc_init_ioppe
 *   Init IOPPE
 *
 */

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

#include <hbotcompid.H>           // HWPF_COMP_ID
#include <attributeenums.H>       // TYPE_PROC
#include <isteps/hwpisteperror.H> //ISTEP_ERROR:IStepError
#include <istepHelperFuncs.H>     // captureError
#include <fapi2/plat_hwp_invoker.H>
#include <nest/nestHwpHelperFuncs.H>
#include <p10_io_init_start_ppe.H>

using namespace ISTEP;
using namespace ISTEP_ERROR;
using namespace ISTEPS_TRACE;
using namespace TARGETING;

namespace ISTEP_08
{

//******************************************************************************
// call_proc_init_ioppe()
//******************************************************************************
void* call_proc_init_ioppe(void *io_pArgs)
{
    IStepError  l_stepError;
    errlHndl_t l_errl = nullptr;

    TRACFCOMP(g_trac_isteps_trace, ENTER_MRK"call_proc_init_ioppe");

    //  get a list of all the procs in the system
    //
    TargetHandleList l_cpuTargetList;
    getAllChips(l_cpuTargetList, TYPE_PROC);

    for (const auto & l_procChip: l_cpuTargetList)
    {
        const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
            l_fapi2_proc_target (l_procChip);

        TRACFCOMP(g_trac_isteps_trace,
                  "Running call_proc_init_ioppe p10_io_init_start_ppe HWP on processor target %.8X",
                  get_huid(l_procChip));

        FAPI_INVOKE_HWP(l_errl,
                        p10_io_init_start_ppe,
                        l_fapi2_proc_target);
        if(l_errl)
        {
            TRACFCOMP(g_trac_isteps_trace,
                      "ERROR : call_proc_init_ioppe p10_io_init_start_ppe target %.8X"
                      TRACE_ERR_FMT,
                      get_huid(l_procChip),
                      TRACE_ERR_ARGS(l_errl));
            captureError(l_errl, l_stepError, HWPF_COMP_ID, l_procChip);
        }

    } // end of cycling through all processor chips

    TRACFCOMP(g_trac_isteps_trace, EXIT_MRK"call_proc_init_ioppe");
    return l_stepError.getErrorHandle();
}
};


text:
//// [server.ts]

export class c { };

//// [client.ts]
import * as nameSpaceBinding from "server";
export var x = new nameSpaceBinding.c();
import * as nameSpaceBinding2 from "server"; // unreferenced

//// [server.js]
var c = (function () {
    function c() {
    }
    return c;
})();
exports.c = c;
;
//// [client.js]
var nameSpaceBinding = require("server");
exports.x = new nameSpaceBinding.c();

//// [server.d.ts]
export declare class c {
}
//// [client.d.ts]
import * as nameSpaceBinding from "server";
export declare var x: nameSpaceBinding.c;


text:
#pragma once

#include <coffee/core/argument_handling.h>
#include <coffee/core/internal_state.h>
#include <coffee/core/libc_types.h>
#include <coffee/core/resource_prefix.h>
#include <coffee/core/types/application_main.h>
#include <peripherals/base.h>
#include <platforms/argument_parse.h>

#if defined(COFFEE_LOWFAT)
#include <coffee/core/task_queue/task.h>
#endif

#if(defined(COFFEE_ANDROID) && defined(COFFEE_USE_SDL2))
#include <jni.h>
#endif

#if defined(COFFEE_SDL_MAIN)
#define main SDL_main
#elif defined(COFFEE_CUSTOM_MAIN)
#include <coffee/foreign/foreign.h>

#define main Coffee_main

/* bootstrapping class, for handing main function pointer over to loader */
struct app_main_init
{
    app_main_init(CoffeeMainWithArgs main_)
    {
        coffee_main_function_ptr = main_;
    }
};

#if defined(COFFEE_ANDROID)
extern CoffeeMainWithArgs android_entry_point;
#endif

#endif

namespace Coffee {

COFFEE_APP_FUNC void SetPlatformState();

}

extern int deref_main(
    CoffeeMainWithArgs mainfun, int argc, char** argv, Coffee::u32 flags = 0);

// This is a cheeky little macro that allows us to wrap the main function.
#if defined(COFFEE_LOWFAT)

#define COFFEE_APPLICATION_MAIN(mainfun)                              \
    int main(int argc, char** argv)                                   \
    {                                                                 \
        using namespace Coffee;                                       \
        RuntimeQueue::SetQueueContext(RuntimeQueue::CreateContext()); \
        State::SetInternalState(State::CreateNewState());             \
        SetPlatformState();                                           \
        GetInitArgs() = ::platform::args::AppArg::Clone(argc, argv);  \
        if(argc >= 2)                                                 \
        {                                                             \
            platform::file::ResourcePrefix(argv[1]);                  \
            GetInitArgs().m_ptrStorage.erase(                         \
                GetInitArgs().m_ptrStorage.begin());                  \
        }                                                             \
                                                                      \
        return mainfun(argc, argv);                                   \
    }

#define COFFEE_APPLICATION_MAIN_CUSTOM_ARG(mainfun) \
    COFFEE_APPLICATION_MAIN(mainfun)

#define COFFEE_APPLICATION_MAIN_CUSTOM(mainfun, flags) \
    COFFEE_APPLICATION_MAIN(mainfun)

#elif defined(COFFEE_SDL_MAIN)

// Wraps it with a custom name defined above
#define COFFEE_APPLICATION_MAIN(mainfun)        \
    extern "C" int main(int argv, char** argc)  \
    {                                           \
        return deref_main(mainfun, argv, argc); \
    }

#define COFFEE_APPLICATION_MAIN_CUSTOM_ARG(mainfun) \
    COFFEE_APPLICATION_MAIN(mainfun)

#define COFFEE_APPLICATION_MAIN_CUSTOM(mainfun, flags) \
    COFFEE_APPLICATION_MAIN(mainfun)

#elif defined(COFFEE_CUSTOM_MAIN)

#if defined(COFFEE_APPLE_MOBILE)
// This is loaded from AppDelegate.m in CoffeeWindow_GLKit
#define COFFEE_APPLICATION_MAIN(mainfun) \
    static app_main_init _coffee_application_main_init(mainfun);

#elif defined(COFFEE_ANDROID)
#define COFFEE_APPLICATION_MAIN(mainfun) \
    CoffeeMainWithArgs android_entry_point = mainfun;

#endif

#define COFFEE_APPLICATION_MAIN_CUSTOM_ARG(mainfun) \
    COFFEE_APPLICATION_MAIN(mainfun)

#define COFFEE_APPLICATION_MAIN_CUSTOM(mainfun, flags) \
    COFFEE_APPLICATION_MAIN(mainfun)

#else

// Plain old main() function
#define COFFEE_APPLICATION_MAIN(mainfun)        \
    int main(int argv, char** argc)             \
    {                                           \
        return deref_main(mainfun, argv, argc); \
    }

#define COFFEE_APPLICATION_MAIN_CUSTOM_ARG(mainfun)  \
    int main(int argv, char** argc)                  \
    {                                                \
        return deref_main(mainfun, argv, argc, 0x1); \
    }

#define COFFEE_APPLICATION_MAIN_CUSTOM(mainfun, flags) \
    int main(int argv, char** argc)                    \
    {                                                  \
        return deref_main(mainfun, argv, argc, flags); \
    }

#define COFFEE_SIMPLE_MAIN(mainfun)                       \
    namespace {                                           \
    int simplified_main(int, char**)                      \
    {                                                     \
        mainfun(0, nullptr);                              \
    }                                                     \
    }                                                     \
    int main(int argv, char** argc)                       \
    {                                                     \
        return deref_main(::simplified_main, argv, argc); \
    }

#endif


text:
var Vue = require('vue');
var item = require('./../mixin/item');

var Image = Vue.extend({
    mixins: [item],
    template:
        '
' +
            '' +
        '
',
    replace: true
});

Vue.component('image', Image);

module.exports = Image;


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="de.madcyph3r.example">

    <application
        android:allowBackup="true"
        android:icon="@drawable/app_drawer_icon"
        android:label="@string/app_name"
        android:theme="@style/MaterialNavigationDrawerTheme.Light"
        tools:replace="android:icon,android:theme">

        <!-- Main Activity. Use Drawer for the examples with parallax recycleview -->
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".DummyActivity">

        </activity>
        <activity
            android:name=".example.testLand.dgdemo"
            android:theme="@style/DG_Lib" />
        <!-- Theme: -->
        <!-- dark theme -->
        <activity
            android:name=".example.theme.DarkThemeActivity"
            android:theme="@style/MaterialNavigationDrawerTheme" />
        <!-- light theme -->
        <activity
            android:name=".example.theme.LightThemeActivity"
            android:theme="@style/MaterialNavigationDrawerTheme.Light" />
        <!-- own theme -->
        <activity
            android:name=".example.theme.MyThemeActivity"
            android:theme="@style/MyOwnTheme" />
        <!-- unique toolbar color -->
        <activity
            android:name=".example.theme.UniqueToolbarColorActivity"
            android:theme="@style/UniqueToolbarColorTheme" />
        <!-- overlay -->
        <activity
            android:name=".example.theme.ActionBarOverlayActivity"
            android:theme="@style/ActionBarOverlayTheme" />
        <!-- KitKat Translucent StatusBar -->
        <activity
            android:name=".example.theme.KitKatTranslucentStatusBarActivity"
            android:theme="@style/MaterialNavigationDrawerTheme.TranslucentKitKatStatusBar" />
        <!-- Actionbar Own Font ActionBar -->
        <activity android:name=".example.theme.ActionBarOwnFontActivity" />
        <!-- Own Drawer Width -->
        <activity android:name=".example.theme.OwnDrawerWidthActivity" />
        <activity
            android:name=".example.theme.OnlyIconsActivity"
            android:theme="@style/BelowToolbarTheme" />

        <!-- Drawer Types -->
        <activity
            android:name=".example.drawerTypes.MultiPaneSupportActivity"
            android:theme="@style/MultiPaneSupportTheme" />
        <activity
            android:name=".example.drawerTypes.MultiPaneSupportBelowToolbarActivity"
            android:theme="@style/MultiPaneBelowToolbarSupportTheme" />

        <!-- Header Types -->
        <activity android:name=".example.headerTypes.NoHeaderActivity" />
        <activity
            android:name=".example.headerTypes.NoHeaderBelowToolbarActivity"
            android:theme="@style/BelowToolbarTheme" />
        <activity android:name=".example.headerTypes.ImageHeaderActivity" />
        <activity
            android:name=".example.headerTypes.ImageHeaderBelowToolbarActivity"
            android:theme="@style/BelowToolbarTheme" />
        <activity android:name=".example.headerTypes.CustomHeaderActivity" />
        <activity
            android:name=".example.headerTypes.CustomHeaderBelowToolbarActivity"
            android:theme="@style/BelowToolbarTheme" />
        <activity android:name=".example.headerTypes.HeadItemOneActivity" />
        <activity
            android:name=".example.headerTypes.HeadItemOneBelowToolbarActivity"
            android:theme="@style/BelowToolbarTheme" />
        <activity android:name=".example.headerTypes.HeadItemThreeActivity" />
        <activity android:name=".example.headerTypes.HeadItemFiveActivity" />

        <!-- Head Item Types -->
        <activity android:name=".example.headItemTypes.HeadItemFiveExtraMenuActivity" />
        <activity android:name=".example.headItemTypes.HeadItemTwoExtraMenuActivity" />
        <activity android:name=".example.headItemTypes.HeadItemThreeDontCloseOnChangeActivity" />
        <activity android:name=".example.headItemTypes.HeadItemFiveDontCloseOnChangeActivity" />
        <activity
            android:name=".example.headItemTypes.HeadItemOneBlackThemeActivity"
            android:theme="@style/MaterialNavigationDrawerTheme" />
        <activity android:name=".example.headItemTypes.HeadItemTwoOnlyOneHasMenuActivity" />
        <activity android:name=".example.headItemTypes.HeadItemTwoNoFragmentLoadOnChangeActivity" />
        <activity android:name=".example.headItemTypes.HeadItem100StaticBackgroundActivity" />

        <!-- Menu -->
        <activity android:name=".example.menu.AllMenuTypesActivity" />
        <activity android:name=".example.menu.AddRemoveMenuItemsActivity" />
        <activity android:name=".example.menu.SectionFragmentTitleActivity" />
        <activity android:name=".example.menu.StartSectionActivity" />

        <!-- Back Pattern -->
        <activity android:name=".example.backPattern.BackPatternCustomActivity" />
        <activity android:name=".example.backPattern.BackPatternDefaultActivity" />
        <activity android:name=".example.backPattern.BackPatternStartIndexActivity" />
        <activity android:name=".example.backPattern.BackPatternLastSectionActivity" />

        <!-- Listener -->
        <activity android:name=".example.listener.HeadItemOneAvatarOnClickListenerActivity" />
        <activity android:name=".example.listener.HeadItemOneBackgroundOnClickListenerActivity" />
        <activity android:name=".example.listener.SectionChangeListenerActivity" />
        <activity android:name=".example.listener.DrawerListenerActivity" />
        <activity android:name=".example.listener.HeadItemThreeChangeListenerActivity" />

        <!-- Functionally -->
        <activity android:name=".example.functionally.ActionBarButtonsActivity" />
        <activity android:name=".example.functionally.AddRemoveHeadItemRuntimeActivity" />
        <activity android:name=".example.functionally.NoClosePrevDrawerActivity_Activity" />
        <activity android:name=".example.functionally.ClosePrevDrawerActivity_Activity" />
        <activity android:name=".example.functionally.SetCustomFragmentActivity" />
        <activity android:name=".example.functionally.MasterChildNavActivity" />

        <!-- Other -->
        <activity android:name=".example.functionally.noClosePrevDrawerActivity.NoCloseActivity" />
        <activity android:name=".example.functionally.closePrevDrawerActivity.CloseActivity" />
    </application>

</manifest>


text:
package com.microsoft.bingads.v10.api.test.entities.ads.text.write;

import com.microsoft.bingads.v10.api.test.entities.ads.text.BulkTextAdTest;
import com.microsoft.bingads.v10.bulk.entities.BulkTextAd;
import com.microsoft.bingads.internal.functionalinterfaces.BiConsumer;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;

@RunWith(Parameterized.class)
public class BulkTextAdWriteToRowValuesDisplayUrlTest extends BulkTextAdTest {

    @Parameter(value = 1)
    public String propertyValue;

    @Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][]{
            {"http://test.url", "http://test.url"},
            {"", ""},
            {null, null},});
    }

    @Test
    public void testWrite() {
        this.<String>testWriteProperty("Display Url", this.datum, this.propertyValue, new BiConsumer<BulkTextAd, String>() {
            @Override
            public void accept(BulkTextAd c, String v) {
                c.getTextAd().setDisplayUrl(v);
            }
        });
    }
}


text:
require_relative '../resources'

describe 'resources::dnsmasq_local_config' do
  include_context 'resources'

  let(:resource) { 'dnsmasq_local_config' }
  %i[filename config].each { |p| let(p) { nil } }
  let(:properties) { { filename: filename, config: config } }
  let(:name) { 'default' }

  shared_context 'the :create action' do
  end

  shared_context 'the :remove action' do
    let(:action) { :remove }
  end

  shared_context 'all default properties' do
  end

  shared_context 'an overridden filename property' do
    let(:filename) { 'monkeypants.conf' }
  end

  shared_context 'an overridden config property' do
    let(:config) do
      {
        interface: 'docker0',
        no_hosts: false,
        example: 'elpmaxe',
        bool: true,
        other_bool: false
      }
    end
  end

  shared_context 'some extra properties' do
    let(:properties) do
      {
        interface: 'docker0',
        no_hosts: false,
        example: 'elpmaxe',
        server: %w[8.8.8.8 8.8.4.4],
        bool: true,
        other_bool: false
      }
    end
  end

  shared_context 'an invalid config property' do
    let(:config) { { example: :bad } }
  end

  shared_examples_for 'any platform' do
    context 'the :create action' do
      include_context description

      shared_examples_for 'any property set' do
        it 'creates the main dnsmasq.conf file' do
          expected = <<-EXP.gsub(/^ +/, '').strip
            # This file is managed by Chef.
            # Any changes to it will be overwritten.
            conf-dir=/etc/dnsmasq.d
          EXP
          expect(chef_run).to create_file('/etc/dnsmasq.conf')
            .with(content: expected)
        end

        it 'creates the dnsmasq.d directory' do
          expect(chef_run).to create_directory('/etc/dnsmasq.d')
        end
      end

      context 'all default properties' do
        include_context description

        it_behaves_like 'any property set'

        it 'generates the expected config' do
          expected = <<-EXP.gsub(/^ +/, '').strip
            # This file is managed by Chef.
            # Any changes to it will be overwritten.
            bind-interfaces
            cache-size=0
            interface=
            no-hosts
            query-port=0
          EXP
          expect(chef_run).to create_file('/etc/dnsmasq.d/default.conf')
            .with(content: expected)
        end
      end

      context 'an overridden filename property' do
        include_context description

        it 'generates the expected config' do
          expected = <<-EXP.gsub(/^ +/, '').strip
            # This file is managed by Chef.
            # Any changes to it will be overwritten.
            bind-interfaces
            cache-size=0
            interface=
            no-hosts
            query-port=0
          EXP
          expect(chef_run).to create_file('/etc/dnsmasq.d/monkeypants.conf')
            .with(content: expected)
        end
      end

      context 'an overridden config property' do
        include_context description

        it_behaves_like 'any property set'

        it 'generates the expected config' do
          expected = <<-EXP.gsub(/^ +/, '').strip
            # This file is managed by Chef.
            # Any changes to it will be overwritten.
            bool
            example=elpmaxe
            interface=docker0
          EXP
          expect(chef_run).to create_file('/etc/dnsmasq.d/default.conf')
            .with(content: expected)
        end
      end

      context 'some extra properties' do
        include_context description

        it_behaves_like 'any property set'

        it 'generates the expected config' do
          expected = <<-EXP.gsub(/^ +/, '').strip
            # This file is managed by Chef.
            # Any changes to it will be overwritten.
            bind-interfaces
            bool
            cache-size=0
            example=elpmaxe
            interface=docker0
            query-port=0
            server=8.8.8.8
            server=8.8.4.4
          EXP
          expect(chef_run).to create_file('/etc/dnsmasq.d/default.conf')
            .with(content: expected)
        end
      end

      context 'an invalid config property' do
        include_context description

        it 'raises an error' do
          expected = Chef::Exceptions::ValidationFailed
          expect { chef_run }.to raise_error(expected)
        end
      end
    end

    context 'the :remove action' do
      include_context description

      let(:other_conf_files?) { nil }

      before do
        allow(Dir).to receive(:exist?).and_call_original
        allow(Dir).to receive(:exist?).with('/etc/dnsmasq.d').and_return(true)
        allow(Dir).to receive(:entries).and_call_original
        allow(Dir).to receive(:entries)
          .with('/etc/dnsmasq.d')
          .and_return(other_conf_files? ? %w[. .. thing2.conf] : %w[. ..])
      end

      shared_examples_for 'any property set' do
        it 'deletes the config file' do
          expect(chef_run).to delete_file(
            "/etc/dnsmasq.d/#{filename || 'default.conf'}"
          )
        end
      end

      shared_examples_for 'an empty conf.d dir' do
        it 'deletes the conf.d dir' do
          expect(chef_run).to delete_directory('/etc/dnsmasq.d')
        end

        it 'deletes the main config file' do
          expect(chef_run).to delete_file('/etc/dnsmasq.conf')
        end
      end

      shared_examples_for 'a populated conf.d dir' do
        it 'does not delete the conf.d dir' do
          expect(chef_run).to_not delete_directory('/etc/dnsmasq.d')
        end

        it 'does not delete the main config file' do
          expect(chef_run).to_not delete_file('/etc/dnsmasq.conf')
        end
      end

      context 'all default properties' do
        include_context description

        context 'an empty conf.d dir' do
          let(:other_conf_files?) { false }

          it_behaves_like 'any property set'
          it_behaves_like 'an empty conf.d dir'
        end

        context 'a populated conf.d dir' do
          let(:other_conf_files?) { true }

          it_behaves_like 'any property set'
          it_behaves_like 'a populated conf.d dir'
        end
      end

      context 'an overridden filename property' do
        include_context description

        context 'an empty conf.d dir' do
          let(:other_conf_files?) { false }

          it_behaves_like 'any property set'
          it_behaves_like 'an empty conf.d dir'
        end

        context 'a populated conf.d dir' do
          let(:other_conf_files?) { true }

          it_behaves_like 'any property set'
          it_behaves_like 'a populated conf.d dir'
        end
      end
    end
  end

  RSpec.configuration.supported_platforms.each do |os, versions|
    context os.to_s.capitalize do
      let(:platform) { os.to_s }

      versions.each do |ver|
        context ver do
          let(:platform_version) { ver }

          it_behaves_like 'any platform'
        end
      end
    end
  end
end