text:
package org.apache.calcite.rel.rules;

import org.apache.calcite.plan.RelOptCluster;
import org.apache.calcite.plan.RelOptRule;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.volcano.RelSubset;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.core.Join;
import org.apache.calcite.rel.core.JoinRelType;
import org.apache.calcite.rel.core.RelFactories;
import org.apache.calcite.rex.RexBuilder;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexPermuteInputsShuttle;
import org.apache.calcite.rex.RexUtil;
import org.apache.calcite.tools.RelBuilderFactory;
import org.apache.calcite.util.ImmutableBitSet;
import org.apache.calcite.util.mapping.Mappings;

import java.util.ArrayList;
import java.util.List;

/**
 * Planner rule that changes a join based on the associativity rule.
 *
 *
((a JOIN b) JOIN c) → (a JOIN (b JOIN c))

 *
 *
We do not need a rule to convert (a JOIN (b JOIN c)) →
 * ((a JOIN b) JOIN c) because we have
 * {@link JoinCommuteRule}.
 *
 * @see JoinCommuteRule
 */
public class JoinAssociateRule extends RelOptRule {
  //~ Static fields/initializers ---------------------------------------------

  /** The singleton. */
  public static final JoinAssociateRule INSTANCE =
      new JoinAssociateRule(RelFactories.LOGICAL_BUILDER);

  //~ Constructors -----------------------------------------------------------

  /**
   * Creates a JoinAssociateRule.
   */
  public JoinAssociateRule(RelBuilderFactory relBuilderFactory) {
    super(
        operand(Join.class,
            operand(Join.class, any()),
            operand(RelSubset.class, any())),
        relBuilderFactory, null);
  }

  //~ Methods ----------------------------------------------------------------

  public void onMatch(final RelOptRuleCall call) {
    final Join topJoin = call.rel(0);
    final Join bottomJoin = call.rel(1);
    final RelNode relA = bottomJoin.getLeft();
    final RelNode relB = bottomJoin.getRight();
    final RelSubset relC = call.rel(2);
    final RelOptCluster cluster = topJoin.getCluster();
    final RexBuilder rexBuilder = cluster.getRexBuilder();

    if (relC.getConvention() != relA.getConvention()) {
      // relC could have any trait-set. But if we're matching say
      // EnumerableConvention, we're only interested in enumerable subsets.
      return;
    }

    //        topJoin
    //        /     \
    //   bottomJoin  C
    //    /    \
    //   A      B

    final int aCount = relA.getRowType().getFieldCount();
    final int bCount = relB.getRowType().getFieldCount();
    final int cCount = relC.getRowType().getFieldCount();
    final ImmutableBitSet aBitSet = ImmutableBitSet.range(0, aCount);
    final ImmutableBitSet bBitSet =
        ImmutableBitSet.range(aCount, aCount + bCount);

    if (!topJoin.getSystemFieldList().isEmpty()) {
      // FIXME Enable this rule for joins with system fields
      return;
    }

    // If either join is not inner, we cannot proceed.
    // (Is this too strict?)
    if (topJoin.getJoinType() != JoinRelType.INNER
        || bottomJoin.getJoinType() != JoinRelType.INNER) {
      return;
    }

    // Goal is to transform to
    //
    //       newTopJoin
    //        /     \
    //       A   newBottomJoin
    //               /    \
    //              B      C

    // Split the condition of topJoin and bottomJoin into a conjunctions. A
    // condition can be pushed down if it does not use columns from A.
    final List<RexNode> top = new ArrayList<>();
    final List<RexNode> bottom = new ArrayList<>();
    JoinPushThroughJoinRule.split(topJoin.getCondition(), aBitSet, top, bottom);
    JoinPushThroughJoinRule.split(bottomJoin.getCondition(), aBitSet, top,
        bottom);

    // Mapping for moving conditions from topJoin or bottomJoin to
    // newBottomJoin.
    // target: | B | C      |
    // source: | A       | B | C      |
    final Mappings.TargetMapping bottomMapping =
        Mappings.createShiftMapping(
            aCount + bCount + cCount,
            0, aCount, bCount,
            bCount, aCount + bCount, cCount);
    final List<RexNode> newBottomList = new ArrayList<>();
    new RexPermuteInputsShuttle(bottomMapping, relB, relC)
        .visitList(bottom, newBottomList);
    RexNode newBottomCondition =
        RexUtil.composeConjunction(rexBuilder, newBottomList, false);

    final Join newBottomJoin =
        bottomJoin.copy(bottomJoin.getTraitSet(), newBottomCondition, relB,
            relC, JoinRelType.INNER, false);

    // Condition for newTopJoin consists of pieces from bottomJoin and topJoin.
    // Field ordinals do not need to be changed.
    RexNode newTopCondition =
        RexUtil.composeConjunction(rexBuilder, top, false);
    final Join newTopJoin =
        topJoin.copy(topJoin.getTraitSet(), newTopCondition, relA,
            newBottomJoin, JoinRelType.INNER, false);

    call.transformTo(newTopJoin);
  }
}

// End JoinAssociateRule.java


text:
package com.googlecode.rocoto.configuration;

import com.google.inject.Inject;
import com.google.inject.name.Named;

/**
 *
 *
 * @author Simone Tripodi
 * @version $Id$
 */
public final class LdapConfiguration {

    @Inject
    @Named("ldap.host")
    private String host;

    @Inject
    @Named("ldap.port")
    private int port;

    @Inject
    @Named("ldap.baseDN")
    private String baseDN;

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getBaseDN() {
        return baseDN;
    }

    public void setBaseDN(String baseDN) {
        this.baseDN = baseDN;
    }

}

redpajama_set_name: RedPajamaGithub


text:
<Alloy>

	<!-- For supported environments (see alloy.js) -->
	<TabGroup if="Alloy.Globals.isSupported">
		<Require platform="ios,android" src="permissions" />
		<Require platform="android" src="cardview" />

		<!-- We took the Tab out because we re-use the android-window in index.js -->
		<Tab platform="android" title="Android">
			<Require src="android" />
		</Tab>

		<Require platform="ios" src="ios" />
		<Require platform="ios" src="autolayout" />
		<Require platform="windows" src="windows" />
		<Require src="console" />
	</TabGroup>

	<!-- For unsupported environments -->
	<Window if="!Alloy.Globals.isSupported">
		<Label>This sample requires Titanium 5.1.</Label>
	</Window>

</Alloy>


text:
//
//  Test-NSString+MBIndentation.m
//  MockingbirdTests
//
//  Created by Evan Coyne Maloney on 4/11/14.
//  Copyright (c) 2014 Gilt Groupe. All rights reserved.
//

#import <XCTest/XCTest.h>

#import "NSString+MBIndentation.h"

/******************************************************************************/
#pragma mark Constants
/******************************************************************************/

NSString* const kMBStringIndentationTestInput = @""
"this\n"
"is\n"
"a\n"
"test\n"
"of the emergency\n"
"broadcast\n"
"system\n";

NSString* const kMBStringIndentationTestOutputOneTab = @""
"\tthis\n"
"\tis\n"
"\ta\n"
"\ttest\n"
"\tof the emergency\n"
"\tbroadcast\n"
"\tsystem\n"
"\t";

NSString* const kMBStringIndentationTestLinePrefix = @"-=[X]=-";

NSString* const kMBStringIndentationTestOutputPrefix = @""
"-=[X]=- this\n"
"-=[X]=- is\n"
"-=[X]=- a\n"
"-=[X]=- test\n"
"-=[X]=- of the emergency\n"
"-=[X]=- broadcast\n"
"-=[X]=- system\n"
"-=[X]=-";

/******************************************************************************/
#pragma mark -
#pragma mark Tests
/******************************************************************************/

@interface MBStringIndentationTests : XCTestCase
@end

@implementation MBStringIndentationTests

- (void) testIndentingWithSingleTab
{
    NSString* indented = [kMBStringIndentationTestInput stringByIndentingEachLineWithTab];
    XCTAssertEqualObjects(indented, kMBStringIndentationTestOutputOneTab, @"unexpected result from stringByIndentingEachLineWithTab");

    indented = [kMBStringIndentationTestInput stringByIndentingEachLineWithTabs:1];
    XCTAssertEqualObjects(indented, kMBStringIndentationTestOutputOneTab, @"unexpected result from stringByIndentingEachLineWithTabs:1");

    indented = [kMBStringIndentationTestInput stringByIndentingEachLineWithPrefix:@"\t"];
    XCTAssertEqualObjects(indented, kMBStringIndentationTestOutputOneTab, @"unexpected result from stringByIndentingEachLineWithPrefix:@\"\\t\"");
}

- (void) _testIndentingString:(NSString*)string withNumberOfTabs:(NSUInteger)tabCount
{
    NSArray* inputLines = [string componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    NSString* indented = [string stringByIndentingEachLineWithTabs:tabCount];
    NSArray* indentedLines = [indented componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    XCTAssertEqual(inputLines.count, indentedLines.count, @"Expected inputLines and indentedLines to have same number of lines");

    NSString* prefix = [@"" stringByPaddingToLength:tabCount withString:@"\t" startingAtIndex:0];

    for (NSUInteger i=0; i<inputLines.count; i++) {
        NSString* indentedLine = indentedLines[i];
        NSString* shouldBeLine = [prefix stringByAppendingString:inputLines[i]];
        XCTAssertEqualObjects(shouldBeLine, indentedLine, @"unexpected value for a line");
    }
}

- (void) testIndentingWithArbitraryTabs
{
    for (NSUInteger i=0; i<100; i++) {
        [self _testIndentingString:kMBStringIndentationTestInput withNumberOfTabs:i];
    }
}

- (void) testPrefixingString
{
    NSArray* inputLines = [kMBStringIndentationTestInput componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    NSString* prefixed = [kMBStringIndentationTestInput stringByIndentingEachLineWithPrefix:kMBStringIndentationTestLinePrefix];
    NSArray* prefixedLines = [prefixed componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]];

    XCTAssertEqual(inputLines.count, prefixedLines.count, @"Expected inputLines and prefixedLines to have same number of lines");

    for (NSUInteger i=0; i<inputLines.count; i++) {
        NSString* prefixedLine = prefixedLines[i];
        NSString* shouldBeLine = [kMBStringIndentationTestLinePrefix stringByAppendingString:inputLines[i]];
        XCTAssertEqualObjects(shouldBeLine, prefixedLine, @"unexpected value for a line");
    }
}

@end


text:
"use strict";

const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const HTMLElement = require("./HTMLElement.js");
const impl = utils.implSymbol;

function HTMLScriptElement() {
  throw new TypeError("Illegal constructor");
}
Object.setPrototypeOf(HTMLScriptElement.prototype, HTMLElement.interface.prototype);
Object.setPrototypeOf(HTMLScriptElement, HTMLElement.interface);

Object.defineProperty(HTMLScriptElement.prototype, "src", {
  get() {
    return this[impl]["src"];
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'src' property on 'HTMLScriptElement': The provided value"
    });
    this[impl]["src"] = V;
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "type", {
  get() {
    const value = this.getAttribute("type");
    return value === null ? "" : value;
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'type' property on 'HTMLScriptElement': The provided value"
    });
    this.setAttribute("type", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "charset", {
  get() {
    const value = this.getAttribute("charset");
    return value === null ? "" : value;
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'charset' property on 'HTMLScriptElement': The provided value"
    });
    this.setAttribute("charset", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "defer", {
  get() {
    return this.hasAttribute("defer");
  },
  set(V) {
    V = conversions["boolean"](V, {
      context: "Failed to set the 'defer' property on 'HTMLScriptElement': The provided value"
    });
    if (V) {
      this.setAttribute("defer", "");
    } else {
      this.removeAttribute("defer");
    }
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "crossOrigin", {
  get() {
    const value = this.getAttribute("crossOrigin");
    return value === null ? "" : value;
  },
  set(V) {
    if (V === null || V === undefined) {
      V = null;
    } else {
      V = conversions["DOMString"](V, {
        context: "Failed to set the 'crossOrigin' property on 'HTMLScriptElement': The provided value"
      });
    }
    this.setAttribute("crossOrigin", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "text", {
  get() {
    return this[impl]["text"];
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'text' property on 'HTMLScriptElement': The provided value"
    });
    this[impl]["text"] = V;
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "nonce", {
  get() {
    const value = this.getAttribute("nonce");
    return value === null ? "" : value;
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'nonce' property on 'HTMLScriptElement': The provided value"
    });
    this.setAttribute("nonce", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "event", {
  get() {
    const value = this.getAttribute("event");
    return value === null ? "" : value;
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'event' property on 'HTMLScriptElement': The provided value"
    });
    this.setAttribute("event", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, "htmlFor", {
  get() {
    const value = this.getAttribute("for");
    return value === null ? "" : value;
  },
  set(V) {
    V = conversions["DOMString"](V, {
      context: "Failed to set the 'htmlFor' property on 'HTMLScriptElement': The provided value"
    });
    this.setAttribute("for", V);
  },
  enumerable: true,
  configurable: true
});

Object.defineProperty(HTMLScriptElement.prototype, Symbol.toStringTag, {
  value: "HTMLScriptElement",
  writable: false,
  enumerable: false,
  configurable: true
});

const iface = {
  mixedInto: [],
  is(obj) {
    if (obj) {
      if (obj[impl] instanceof Impl.implementation) {
        return true;
      }
      for (let i = 0; i < module.exports.mixedInto.length; ++i) {
        if (obj instanceof module.exports.mixedInto[i]) {
          return true;
        }
      }
    }
    return false;
  },
  isImpl(obj) {
    if (obj) {
      if (obj instanceof Impl.implementation) {
        return true;
      }

      const wrapper = utils.wrapperForImpl(obj);
      for (let i = 0; i < module.exports.mixedInto.length; ++i) {
        if (wrapper instanceof module.exports.mixedInto[i]) {
          return true;
        }
      }
    }
    return false;
  },
  convert(obj, { context = "The provided value" } = {}) {
    if (module.exports.is(obj)) {
      return utils.implForWrapper(obj);
    }
    throw new TypeError(`${context} is not of type 'HTMLScriptElement'.`);
  },
  create(constructorArgs, privateData) {
    let obj = Object.create(HTMLScriptElement.prototype);
    this.setup(obj, constructorArgs, privateData);
    return obj;
  },
  createImpl(constructorArgs, privateData) {
    let obj = Object.create(HTMLScriptElement.prototype);
    this.setup(obj, constructorArgs, privateData);
    return utils.implForWrapper(obj);
  },
  _internalSetup(obj) {
    HTMLElement._internalSetup(obj);
  },
  setup(obj, constructorArgs, privateData) {
    if (!privateData) privateData = {};
    privateData.wrapper = obj;

    this._internalSetup(obj);

    Object.defineProperty(obj, impl, {
      value: new Impl.implementation(constructorArgs, privateData),
      writable: false,
      enumerable: false,
      configurable: true
    });
    obj[impl][utils.wrapperSymbol] = obj;
  },
  interface: HTMLScriptElement,
  expose: {
    Window: { HTMLScriptElement: HTMLScriptElement }
  }
};
module.exports = iface;

const Impl = require("../nodes/HTMLScriptElement-impl.js");


text:
module ListSpec where

import Control.Applicative
import Language.Haskell.GhcMod
import Test.Hspec
import TestUtils

spec :: Spec
spec = do
    describe "modules" $ do
        it "contains at least `Data.Map'" $ do
            mdls <- runD $ lines <$> modules
            mdls `shouldContain` ["Data.Map"]


text:
/**
 * @file test_hott_telemetry.c
 * Tests the Graupner HoTT telemetry support.
 */

#include <px4_time.h>
#include <px4_config.h>
#include <px4_defines.h>
#include <px4_log.h>
#include <px4_posix.h>
#include <sys/ioctl.h>
#include <sys/types.h>

#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

#include "tests_main.h"

static int open_uart(const char *device)
{
	/* baud rate */
	int speed = B19200;

	/* open uart */
	int uart = open(device, O_RDWR | O_NOCTTY);

	if (uart < 0) {
		PX4_ERR("FAIL: Error opening port");
		return ERROR;
	}

	/* Try to set baud rate */
	struct termios uart_config;

	/* Fill the struct for the new configuration */
	tcgetattr(uart, &uart_config);

	/* Clear ONLCR flag (which appends a CR for every LF) */
	uart_config.c_oflag &= ~ONLCR;

	/* Set baud rate */
	if (cfsetispeed(&uart_config, speed) < 0 || cfsetospeed(&uart_config, speed) < 0) {
		PX4_ERR("FAIL: Error setting baudrate / termios config for cfsetispeed, cfsetospeed");
		return ERROR;
	}

	if (tcsetattr(uart, TCSANOW, &uart_config) < 0) {
		PX4_ERR("FAIL: Error setting baudrate / termios config for tcsetattr");
		return ERROR;
	}

	return uart;
}

int test_hott_telemetry(int argc, char *argv[])
{
	PX4_INFO("HoTT Telemetry Test Requirements:");
	PX4_INFO("- Radio on and Electric Air. Mod on (telemetry -> sensor select).");
	PX4_INFO("- Receiver telemetry port must be in telemetry mode.");
	PX4_INFO("- Connect telemetry wire to /dev/ttyS1 (USART2).");
	PX4_INFO("Testing...");

	const char device[] = "/dev/ttyS1";
	int fd = open_uart(device);

	if (fd < 0) {
		close(fd);
		return ERROR;
	}

#ifdef TIOCSSINGLEWIRE
	/* Activate single wire mode */
	ioctl(fd, TIOCSSINGLEWIRE, SER_SINGLEWIRE_ENABLED);
#endif

	char send = 'a';
	write(fd, &send, 1);

	/* Since TX and RX are now connected we should be able to read in what we wrote */
	const int timeout = 1000;
	struct pollfd fds[] = { { .fd = fd, .events = POLLIN } };

	if (poll(fds, 1, timeout) == 0) {
		PX4_ERR("FAIL: Could not read sent data.");
		return 1;
	}

	char receive;
	read(fd, &receive, 1);
	PX4_INFO("PASS: Single wire enabled. Sent %x and received %x", send, receive);

	/* Attempt to read HoTT poll messages from the HoTT receiver */
	int received_count = 0;
	int valid_count = 0;
	const int max_polls = 5;
	uint8_t byte;

	for (; received_count < 5; received_count++) {
		if (poll(fds, 1, timeout) == 0) {
			PX4_ERR("FAIL: Could not read sent data. Is your HoTT receiver plugged in on %s?", device);
			return 1;

		} else {
			read(fd, &byte, 1);

			if (byte == 0x80) {
				valid_count++;
			}

			/* Read the device ID being polled */
			read(fd, &byte, 1);
		}
	}

	if (received_count > 0 && valid_count > 0) {
		if (received_count == max_polls && valid_count == max_polls) {
			PX4_INFO("PASS: Received %d out of %d valid byte pairs from the HoTT receiver device.", received_count, max_polls);

		} else {
			PX4_WARN("WARN: Received %d out of %d byte pairs of which %d were valid from the HoTT receiver device.", received_count,
				 max_polls, valid_count);
		}

	} else {
		/* Let's work out what went wrong */
		if (received_count == 0) {
			PX4_ERR("FAIL: Could not read any polls from HoTT receiver device.");
			return 1;
		}

		if (valid_count == 0) {
			PX4_ERR("FAIL: Received unexpected values from the HoTT receiver device.");
			return 1;
		}
	}

	/* Attempt to send a HoTT response messages */
	uint8_t response[] = {0x7c, 0x8e, 0x00, 0xe0, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, \
			      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
			      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x01, 0x00, 0x00, \
			      0x19, 0x00, 0x00, 0x00, 0x30, 0x75, 0x78, 0x00, 0x00, 0x00, \
			      0x00, 0x00, 0x00, 0x7d, 0x12
			     };

	px4_usleep(5000);

	for (unsigned int i = 0; i < sizeof(response); i++) {
		write(fd, &response[i], 1);
		px4_usleep(1000);
	}

	PX4_INFO("PASS: Response sent to the HoTT receiver device. Voltage should now show 2.5V.");

#ifdef TIOCSSINGLEWIRE
	/* Disable single wire */
	ioctl(fd, TIOCSSINGLEWIRE, ~SER_SINGLEWIRE_ENABLED);
#endif

	write(fd, &send, 1);

	/* We should timeout as there will be nothing to read (TX and RX no longer connected) */
	if (poll(fds, 1, timeout) == 0) {
		PX4_ERR("FAIL: timeout expected.");
		return 1;
	}

	PX4_INFO("PASS: Single wire disabled.");

	close(fd);
	return 0;
}


text:
""" XVM (c) https://modxvm.com 2013-2020 """

import pprint

from xfw import Logger, IS_DEVELOPMENT
from xfw_actionscript.python import swf
from xfw.constants import PATH

if swf.g_xvmlogger is None:
    swf.g_xvmlogger = Logger(PATH.XVM_LOG_FILE_NAME)

def log(s, prefix='', *args, **kwargs):
    if not isinstance(s, basestring):
        s = pprint.pformat(s, *args, **kwargs)
    swf.g_xvmlogger.add('%s%s' % (prefix, s))

def err(s, *args, **kwargs):
    if not isinstance(s, basestring):
        s = pprint.pformat(s, *args, **kwargs)
    swf.g_xvmlogger.error(s)

def warn(s, *args, **kwargs):
    if not isinstance(s, basestring):
        s = pprint.pformat(s, *args, **kwargs)
    swf.g_xvmlogger.warning(s)

def debug(s, *args, **kwargs):
    if not isinstance(s, basestring):
        s = pprint.pformat(s, *args, **kwargs)
    swf.g_xvmlogger.debug(s)

def trace(s, *args, **kwargs):
    if IS_DEVELOPMENT:
        log(s, '[TRACE] >> ', *args, **kwargs)


text:
package org.jboss.resteasy.cdi.decorators;

import java.util.logging.Logger;

import javax.decorator.Decorator;
import javax.decorator.Delegate;
import javax.inject.Inject;
import javax.ws.rs.ext.WriterInterceptor;
import javax.ws.rs.ext.WriterInterceptorContext;

@Decorator
public abstract class BookWriterInterceptorDecorator implements WriterInterceptor
{
   @Inject private Logger log;
   @Inject private @Delegate BookWriterInterceptor interceptor;

   @Override
   public void aroundWriteTo(WriterInterceptorContext context) throws java.io.IOException, javax.ws.rs.WebApplicationException
   {
      log.info("entering BookWriterInterceptorDecorator.aroundWriteTo()");
      VisitList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_ENTER);
      interceptor.aroundWriteTo(context);
      VisitList.add(VisitList.WRITER_INTERCEPTOR_DECORATOR_LEAVE);
      log.info("leaving BookWriterInterceptorDecorator.aroundWriteTo()");
   }
}


text:
/*
 * 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.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.testing.model;

/**
 * A list of iOS device configurations in which the test is to be executed.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Testing API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class IosDeviceList extends com.google.api.client.json.GenericJson {

  /**
   * Required. A list of iOS devices.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.util.List<IosDevice> iosDevices;

  static {
    // hack to force ProGuard to consider IosDevice used, since otherwise it would be stripped out
    // see https://github.com/google/google-api-java-client/issues/543
    com.google.api.client.util.Data.nullOf(IosDevice.class);
  }

  /**
   * Required. A list of iOS devices.
   * @return value or {@code null} for none
   */
  public java.util.List<IosDevice> getIosDevices() {
    return iosDevices;
  }

  /**
   * Required. A list of iOS devices.
   * @param iosDevices iosDevices or {@code null} for none
   */
  public IosDeviceList setIosDevices(java.util.List<IosDevice> iosDevices) {
    this.iosDevices = iosDevices;
    return this;
  }

  @Override
  public IosDeviceList set(String fieldName, Object value) {
    return (IosDeviceList) super.set(fieldName, value);
  }

  @Override
  public IosDeviceList clone() {
    return (IosDeviceList) super.clone();
  }

}


text:
package com.cjm721.overloaded.config;

import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.fml.config.ModConfig;

public interface ConfigSectionHandler {
  void appendToBuilder(ModConfig.Type type, ForgeConfigSpec.Builder builder);
  void update();
}


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

import com.google.common.util.concurrent.ListenableFuture;
import io.trino.spi.Page;

import java.io.Closeable;
import java.util.Iterator;
import java.util.List;

public interface Spiller
        extends Closeable
{
    /**
     * Initiate spilling of pages stream. Returns completed future once spilling has finished.
     */
    ListenableFuture<?> spill(Iterator<Page> pageIterator);

    /**
     * Returns list of previously spilled Pages streams.
     */
    List<Iterator<Page>> getSpills();

    /**
     * Close releases/removes all underlying resources used during spilling
     * like for example all created temporary files.
     */
    @Override
    void close();
}


text:
from twisted.internet.defer import inlineCallbacks, Deferred, DeferredQueue
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor

from vumi.tests.utils import get_stubbed_channel
from vumi.blinkenlights import metrics_workers
from vumi.blinkenlights.message20110818 import MetricMessage
from vumi.tests.helpers import VumiTestCase, WorkerHelper

class BrokerWrapper(object):
    """Wrap utility methods around a FakeAMQPBroker."""
    def __init__(self, broker):
        self._broker = broker

    def __getattr__(self, name):
        return getattr(self._broker, name)

    def send_datapoints(self, exchange, queue, datapoints):
        """Publish datapoints to a broker."""
        msg = MetricMessage()
        msg.extend(datapoints)
        self._broker.publish_message(exchange, queue, msg)

    def recv_datapoints(self, exchange, queue):
        """Retrieve datapoints from a broker."""
        vumi_msgs = self._broker.get_messages(exchange, queue)
        msgs = [MetricMessage.from_dict(vm.payload) for vm in vumi_msgs]
        return [msg.datapoints() for msg in msgs]

class TestMetricTimeBucket(VumiTestCase):
    def setUp(self):
        self.worker_helper = self.add_helper(WorkerHelper())

    @inlineCallbacks
    def test_bucketing(self):
        config = {'buckets': 4, 'bucket_size': 5}
        worker = yield self.worker_helper.get_worker(
            metrics_workers.MetricTimeBucket, config=config)
        broker = BrokerWrapper(self.worker_helper.broker)

        datapoints = [
            ("vumi.test.foo", ("agg",), [(1230, 1.5), (1235, 2.0)]),
            ("vumi.test.bar", ("sum",), [(1240, 1.0)]),
            ]
        broker.send_datapoints("vumi.metrics", "vumi.metrics", datapoints)
        yield broker.kick_delivery()

        buckets = [broker.recv_datapoints("vumi.metrics.buckets",
                                          "bucket.%d" % i) for i in range(4)]

        expected_buckets = [
            [],
            [[[u'vumi.test.bar', ['sum'], [[1240, 1.0]]]]],
            [[[u'vumi.test.foo', ['agg'], [[1230, 1.5]]]],
             [[u'vumi.test.foo', ['agg'], [[1235, 2.0]]]]],
            [],
            ]

        self.assertEqual(buckets, expected_buckets)

        yield worker.stopWorker()

class TestMetricAggregator(VumiTestCase):

    def setUp(self):
        self.now = 0
        self.worker_helper = self.add_helper(WorkerHelper())
        self.broker = BrokerWrapper(self.worker_helper.broker)

    def fake_time(self):
        return self.now

    @inlineCallbacks
    def test_aggregating(self):
        config = {'bucket': 3, 'bucket_size': 5}
        worker = yield self.worker_helper.get_worker(
            metrics_workers.MetricAggregator, config, start=False)
        worker._time = self.fake_time
        yield worker.startWorker()

        datapoints = [
            ("vumi.test.foo", ("avg",), [(1235, 1.5), (1236, 2.0)]),
            ("vumi.test.foo", ("sum",), [(1240, 1.0)]),
            ]
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.2", datapoints)
        yield self.broker.kick_delivery()

        def recv():
            return self.broker.recv_datapoints("vumi.metrics.aggregates",
                                               "vumi.metrics.aggregates")

        expected = []
        self.now = 1241
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        expected.append([["vumi.test.foo.avg", [], [[1235, 1.75]]]])
        self.now = 1246
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        # skip a few checks
        expected.append([["vumi.test.foo.sum", [], [[1240, 2.0]]]])
        self.now = 1261
        worker.check_buckets()
        self.assertEqual(recv(), expected)

    @inlineCallbacks
    def test_aggregating_last(self):
        config = {'bucket': 3, 'bucket_size': 5}
        worker = yield self.worker_helper.get_worker(
            metrics_workers.MetricAggregator, config, start=False)
        worker._time = self.fake_time
        yield worker.startWorker()

        datapoints = [
            ("vumi.test.foo", ("last",), [(1235, 1.5), (1236, 2.0)]),
            ("vumi.test.bar", ("last",), [(1241, 1.0), (1240, 2.0)]),
            ]
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.2", datapoints)
        yield self.broker.kick_delivery()

        def recv():
            return self.broker.recv_datapoints("vumi.metrics.aggregates",
                                               "vumi.metrics.aggregates")

        expected = []
        self.now = 1241
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        expected.append([["vumi.test.foo.last", [], [[1235, 2.0]]]])
        self.now = 1246
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        # skip a few checks
        expected.append([["vumi.test.bar.last", [], [[1240, 1.0]]]])
        self.now = 1261
        worker.check_buckets()
        self.assertEqual(recv(), expected)

    @inlineCallbacks
    def test_aggregating_lag(self):
        config = {'bucket': 3, 'bucket_size': 5, 'lag': 1}
        worker = yield self.worker_helper.get_worker(
            metrics_workers.MetricAggregator, config, start=False)
        worker._time = self.fake_time
        yield worker.startWorker()

        datapoints = [
            ("vumi.test.foo", ("avg",), [(1235, 1.5), (1236, 2.0)]),
            ("vumi.test.foo", ("sum",), [(1240, 1.0)]),
            ]
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.3", datapoints)
        self.broker.send_datapoints(
            "vumi.metrics.buckets", "bucket.2", datapoints)
        yield self.broker.kick_delivery()

        def recv():
            return self.broker.recv_datapoints("vumi.metrics.aggregates",
                                               "vumi.metrics.aggregates")

        expected = []
        self.now = 1237
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        expected.append([["vumi.test.foo.avg", [], [[1235, 1.75]]]])
        self.now = 1242
        worker.check_buckets()
        self.assertEqual(recv(), expected)

        # skip a few checks
        expected.append([["vumi.test.foo.sum", [], [[1240, 2.0]]]])
        self.now = 1257
        worker.check_buckets()
        self.assertEqual(recv(), expected)

class TestAggregationSystem(VumiTestCase):
    """Tests tying MetricTimeBucket and MetricAggregator together."""

    def setUp(self):
        self.aggregator_workers = []
        self.now = 0
        self.worker_helper = self.add_helper(WorkerHelper())
        self.broker = BrokerWrapper(self.worker_helper.broker)

    def fake_time(self):
        return self.now

    def send(self, datapoints):
        self.broker.send_datapoints("vumi.metrics",
                                    "vumi.metrics", datapoints)

    def recv(self):
        return self.broker.recv_datapoints("vumi.metrics.aggregates",
                                           "vumi.metrics.aggregates")

    @inlineCallbacks
    def _setup_workers(self, bucketters, aggregators, bucket_size):
        bucket_config = {
            'buckets': aggregators,
            'bucket_size': bucket_size,
        }
        for _i in range(bucketters):
            worker = yield self.worker_helper.get_worker(
                metrics_workers.MetricTimeBucket, bucket_config)

        aggregator_config = {
            'bucket_size': bucket_size,
        }
        for i in range(aggregators):
            config = aggregator_config.copy()
            config['bucket'] = i
            worker = yield self.worker_helper.get_worker(
                metrics_workers.MetricAggregator, config=config, start=False)
            worker._time = self.fake_time
            yield worker.startWorker()
            self.aggregator_workers.append(worker)

    # TODO: use parameteric test cases to test many combinations of workers
    @inlineCallbacks
    def test_aggregating_one_metric(self):
        yield self._setup_workers(1, 1, 5)

        datapoints = [("vumi.test.foo", ["sum"], [(12345, 1.0), (12346, 2.0)])]
        self.send(datapoints)
        self.send(datapoints)

        yield self.broker.kick_delivery()  # deliver to bucketters
        yield self.broker.kick_delivery()  # deliver to aggregators
        self.now = 12355
        for worker in self.aggregator_workers:
            worker.check_buckets()

        datapoints, = self.recv()
        self.assertEqual(datapoints, [
            ["vumi.test.foo.sum", [], [[12345, 6.0]]]
        ])

class TestGraphitePublisher(VumiTestCase):
    def setUp(self):
        self.worker_helper = self.add_helper(WorkerHelper())

    def _check_msg(self, channel, metric, value, timestamp):
        [msg] = self.worker_helper.broker.get_dispatched("graphite", metric)
        self.assertEqual(msg.properties, {"delivery mode": 2})
        self.assertEqual(msg.body, "%f %d" % (value, timestamp))

    @inlineCallbacks
    def test_publish_metric(self):
        datapoint = ("vumi.test.v1", 1.0, 1234)
        channel = yield get_stubbed_channel(self.worker_helper.broker)
        pub = metrics_workers.GraphitePublisher()
        pub.start(channel)
        pub.publish_metric(*datapoint)
        self._check_msg(channel, *datapoint)

class TestGraphiteMetricsCollector(VumiTestCase):
    def setUp(self):
        self.worker_helper = self.add_helper(WorkerHelper())
        self.broker = BrokerWrapper(self.worker_helper.broker)

    @inlineCallbacks
    def test_single_message(self):
        yield self.worker_helper.get_worker(
            metrics_workers.GraphiteMetricsCollector, {})

        datapoints = [("vumi.test.foo", "", [(1234, 1.5)])]
        self.broker.send_datapoints("vumi.metrics.aggregates",
                                    "vumi.metrics.aggregates", datapoints)
        yield self.broker.kick_delivery()

        content, = self.broker.get_dispatched("graphite", "vumi.test.foo")
        parts = content.body.split()
        value, ts = float(parts[0]), int(parts[1])
        self.assertEqual(value, 1.5)
        self.assertEqual(ts, 1234)

class UDPMetricsCatcher(DatagramProtocol):
    def __init__(self):
        self.queue = DeferredQueue()

    def datagramReceived(self, datagram, addr):
        self.queue.put(datagram)

class TestUDPMetricsCollector(VumiTestCase):
    @inlineCallbacks
    def setUp(self):
        self.worker_helper = self.add_helper(WorkerHelper())
        self.broker = BrokerWrapper(self.worker_helper.broker)
        self.udp_protocol = UDPMetricsCatcher()
        self.udp_server = yield reactor.listenUDP(0, self.udp_protocol)
        self.add_cleanup(self.udp_server.stopListening)
        self.worker = yield self.worker_helper.get_worker(
            metrics_workers.UDPMetricsCollector, {
                'metrics_host': '127.0.0.1',
                'metrics_port': self.udp_server.getHost().port,
            })

    def send_metrics(self, *metrics):
        datapoints = [("vumi.test.foo", "", list(metrics))]
        self.broker.send_datapoints("vumi.metrics.aggregates",
                                    "vumi.metrics.aggregates", datapoints)
        return self.broker.kick_delivery()

    @inlineCallbacks
    def test_single_message(self):
        yield self.send_metrics((1234, 1.5))
        received = yield self.udp_protocol.queue.get()
        self.assertEqual('1970-01-01 00:20:34 vumi.test.foo 1.5\n', received)

    @inlineCallbacks
    def test_multiple_messages(self):
        yield self.send_metrics((1234, 1.5), (1235, 2.5))
        received = yield self.udp_protocol.queue.get()
        self.assertEqual('1970-01-01 00:20:34 vumi.test.foo 1.5\n', received)
        received = yield self.udp_protocol.queue.get()
        self.assertEqual('1970-01-01 00:20:35 vumi.test.foo 2.5\n', received)

class TestRandomMetricsGenerator(VumiTestCase):

    def setUp(self):
        self.worker_helper = self.add_helper(WorkerHelper())
        self.broker = BrokerWrapper(self.worker_helper.broker)
        self._on_run = Deferred()
        self.add_cleanup(lambda: self._on_run.callback(None))

    def on_run(self, worker):
        d, self._on_run = self._on_run, Deferred()
        d.callback(None)

    def wake_after_run(self):
        return self._on_run

    @inlineCallbacks
    def test_one_run(self):
        worker = yield self.worker_helper.get_worker(
            metrics_workers.RandomMetricsGenerator, {
                "manager_period": "0.1",
                "generator_period": "0.1",
            }, start=False)
        worker.on_run = self.on_run
        yield worker.startWorker()

        yield self.wake_after_run()
        yield self.wake_after_run()

        datasets = self.broker.recv_datapoints('vumi.metrics', 'vumi.metrics')
        # there should be a least one but there may be more
        # than one if the tests are running slowly
        datapoints = datasets[0]
        self.assertEqual(sorted(d[0] for d in datapoints),
                         ["vumi.random.count", "vumi.random.timer",
                          "vumi.random.value"])


text:
package notification

import (
	log "github.com/Sirupsen/logrus"
	"github.com/postgres-ci/app-server/src/common/errors"
	"github.com/postgres-ci/app-server/src/env"
)

func UpdateMethod(userID int32, method, textID string) error {

	if _, err := env.Connect().Exec("SELECT notification.update_method($1, $2, $3)", userID, method, textID); err != nil {

		err := errors.Wrap(err)

		if err.(*errors.Error).IsFatal() {

			log.Errorf("Could not update notification method: %v", err)
		}

		return err
	}

	return nil
}


text:
package edu.wfu.inotado.marshalobj.win;

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

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

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element ref="{}users"/>
 *         <element ref="{}usertype"/>
 *         <element ref="{}userid"/>
 *         <element ref="{}format"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "users",
    "usertype",
    "userid",
    "format"
})
@XmlRootElement(name = "winrequest")
public class Winrequest {

    @XmlElement(required = true)
    protected Users users;
    @XmlElement(required = true)
    protected String usertype;
    @XmlElement(required = true)
    protected String userid;
    @XmlElement(required = true)
    protected String format;

    /**
     * Gets the value of the users property.
     *
     * @return
     *     possible object is
     *     {@link Users }
     *
     */
    public Users getUsers() {
        return users;
    }

    /**
     * Sets the value of the users property.
     *
     * @param value
     *     allowed object is
     *     {@link Users }
     *
     */
    public void setUsers(Users value) {
        this.users = value;
    }

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

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

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

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

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

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

}


text:
#include "Force Field.h"
#include "Groups Mask.h"
#include "Functions.h"
#include "Math.h"
#include "Scene.h"
#include "Force Field Description.h"
#include "Force Field Shape.h"
#include "Force Field Shape Description.h"
#include "Box Force Field Shape.h"
#include "Sphere Force Field Shape.h"
#include "Capsule Force Field Shape.h"
#include "Actor.h"
#include "Element Collection.h"
#include "Convex Force Field Shape.h"
#include "Convex Force Field Shape Description.h"
#include "Force Field Shape Group.h"

#include <NxForceField.h>
#include <NxForceFieldShape.h>

using namespace StillDesign::PhysX;

ForceField::SamplePointForcesResult::SamplePointForcesResult( array<Vector3>^ forces, array<Vector3>^ torques )
{
	_forces = forces;
	_torques = torques;
}

array<Vector3>^ ForceField::SamplePointForcesResult::Forces::get()
{
	return _forces;
}
array<Vector3>^ ForceField::SamplePointForcesResult::Torques::get()
{
	return _torques;
}

//

ForceField::ForceField( NxForceField* forceField )
{
	Debug::Assert( forceField != NULL );

	ObjectTable::Add( (intptr_t)forceField, this );

	_forceField = forceField;
	_scene = ObjectTable::GetObject<StillDesign::PhysX::Scene^>( (intptr_t)(&forceField->getScene()) );

	if( forceField->getActor() != NULL )
		_actor = ObjectTable::GetObject<StillDesign::PhysX::Actor^>( (intptr_t)forceField->getActor() );
	_forceFieldKernel = ObjectTable::GetObject<StillDesign::PhysX::ForceFieldKernel^>( (intptr_t)forceField->getForceFieldKernel() );

	_shapeGroups = gcnew ElementCollection< ForceFieldShapeGroup^ >();
	forceField->resetShapeGroupsIterator();
	for( unsigned int x = 0; x < forceField->getNbShapeGroups(); x++ )
	{
		_shapeGroups->Add( ObjectTable::GetObject<ForceFieldShapeGroup^>( (intptr_t)forceField->getNextShapeGroup() ) );
	}
}
ForceField::~ForceField()
{
	this->!ForceField();
}
ForceField::!ForceField()
{
	if( this->IsDisposed )
		return;

	OnDisposing( this, nullptr );

	_scene->UnmanagedPointer->releaseForceField( *_forceField );

	_forceField = NULL;

	_scene = nullptr;
	_actor = nullptr;
	_shapeGroups = nullptr;
	_userData = nullptr;

	OnDisposed( this, nullptr );
}
bool ForceField::IsDisposed::get()
{
	return ( _forceField == NULL );
}

void ForceField::AddShapeGroup( ForceFieldShapeGroup^ group )
{
	ThrowIfNullOrDisposed( group, "group" );

	_shapeGroups->Add( group );

	_forceField->addShapeGroup( *group->UnmanagedPointer );
}
bool ForceField::RemoveShapeGroup( ForceFieldShapeGroup^ group )
{
	ThrowIfNullOrDisposed( group, "group" );

	_forceField->removeShapeGroup( *group->UnmanagedPointer );

	return _shapeGroups->Remove( group );
}

ForceField::SamplePointForcesResult^ ForceField::SamplePointForces( array<Vector3>^ points )
{
	return ForceField::SamplePointForces( points, nullptr );
}
ForceField::SamplePointForcesResult^ ForceField::SamplePointForces( array<Vector3>^ points, array<Vector3>^ velocities )
{
	ThrowIfNull( points, "points" );

	// Check input for validity
	// If the velocities argument is supplied, it must be the same length as the points argument
	if( velocities != nullptr )
	{
		if( velocities->Length != points->Length )
			throw gcnew ArgumentException( "Invalid length. Both points and velocities must be the same length", "velocities" );
	}

	int numberOfPoints = points->Length;

	// If the number of points request is 0, then early out and return an empty structure
	if( numberOfPoints == 0 )
		return gcnew SamplePointForcesResult( gcnew array<Vector3>( 0 ), gcnew array<Vector3>( 0 ) );

	// Copy points and vertices into unmanaged memory
	NxVec3* p = new NxVec3[ numberOfPoints ];
	{
		pin_ptr<Vector3> b = &points[ 0 ];
		memcpy_s( p, sizeof( Vector3 ) * numberOfPoints, b, numberOfPoints * sizeof( Vector3 ) );
	}

	NxVec3* v;
	if( velocities != nullptr )
	{
		v = new NxVec3[ numberOfPoints ];
		{
			pin_ptr<Vector3> b = &velocities[ 0 ];
			memcpy_s( v, sizeof( Vector3 ) * numberOfPoints, b, numberOfPoints * sizeof( Vector3 ) );
		}
	}else{
		v = NULL;
	}

	NxVec3* forces = new NxVec3[ numberOfPoints ];
	NxVec3* torques = new NxVec3[ numberOfPoints ];

	//

	_forceField->samplePoints( numberOfPoints, p, v, forces, torques );

	//

	// Copy unmanaged memory into managed memory
	array<Vector3>^ f = gcnew array<Vector3>( numberOfPoints );
	array<Vector3>^ t = gcnew array<Vector3>( numberOfPoints );

	{
		pin_ptr<Vector3> b = &f[ 0 ];
		memcpy_s( b, sizeof( Vector3 ) * numberOfPoints, forces, numberOfPoints * sizeof( Vector3 ) );
	}
	{
		pin_ptr<Vector3> b = &t[ 0 ];
		memcpy_s( b, sizeof( Vector3 ) * numberOfPoints, torques, numberOfPoints * sizeof( Vector3 ) );
	}

	// Dispose of the unmanaged memory
	delete[] p, v, forces, torques;
	p = v = forces = torques = NULL;

	return gcnew ForceField::SamplePointForcesResult( f, t );
}

String^ ForceField::Name::get()
{
	return StillDesign::PhysX::Functions::UnmanagedToManagedString( _forceField->getName() );
}
void ForceField::Name::set( String^ value )
{
	_forceField->setName( StillDesign::PhysX::Functions::ManagedToUnmanagedString( value ) );
}
StillDesign::PhysX::Scene^ ForceField::Scene::get()
{
	return _scene;
}

StillDesign::PhysX::Actor^ ForceField::Actor::get()
{
	return _actor;
}
void ForceField::Actor::set( StillDesign::PhysX::Actor^ value )
{
	_actor = value;

	if( value == nullptr )
		_forceField->setActor( NULL );
	else
		_forceField->setActor( _actor->UnmanagedPointer );
}
ReadOnlyList< ForceFieldShapeGroup^ >^ ForceField::ShapeGroups::get()
{
	return _shapeGroups->ReadOnlyCollection;
}

StillDesign::PhysX::ForceFieldKernel^ ForceField::ForceFieldKernel::get()
{
	return _forceFieldKernel;
}
void ForceField::ForceFieldKernel::set( StillDesign::PhysX::ForceFieldKernel^ value )
{
	ThrowIfDisposed( value, "value" );

	_forceFieldKernel = value;

	if( value == nullptr )
		_forceField->setForceFieldKernel( NULL );
	else
		_forceField->setForceFieldKernel( value->UnmanagedPointer );
}

Matrix ForceField::Pose::get()
{
	return Math::Mat34ToMatrix( &_forceField->getPose() );
}
void ForceField::Pose::set( Matrix value )
{
	_forceField->setPose( Math::MatrixToMat34( value ) );
}

ForceFieldCoordinate ForceField::Coordinates::get()
{
	return (ForceFieldCoordinate)_forceField->getCoordinates();
}
void ForceField::Coordinates::set( ForceFieldCoordinate value )
{
	_forceField->setCoordinates( (NxForceFieldCoordinates)value );
}

short ForceField::Group::get()
{
	return _forceField->getGroup();
}
void ForceField::Group::set( short value )
{
	_forceField->setGroup( value );
}
StillDesign::PhysX::GroupsMask ForceField::GroupsMask::get()
{
	return (StillDesign::PhysX::GroupsMask)_forceField->getGroupsMask();
}
void ForceField::GroupsMask::set( StillDesign::PhysX::GroupsMask value )
{
	_forceField->setGroupsMask( (NxGroupsMask)value );
}

ForceFieldFlag ForceField::Flags::get()
{
	return (ForceFieldFlag)_forceField->getFlags();
}
void  ForceField::Flags::set( ForceFieldFlag value )
{
	_forceField->setFlags( (NxForceFieldFlags)value );
}

Object^ ForceField::UserData::get()
{
	return _userData;
}
void ForceField::UserData::set( Object^ value )
{
	_userData = value;
}

NxForceField* ForceField::UnmanagedPointer::get()
{
	return _forceField;
}


text:
package com.aspose.cells.cloud.examples.cells;

import com.aspose.cells.cloud.examples.Utils;
import java.io.IOException;
import java.nio.file.Path;

public class GetFirstCellWorksheet {

    public static void main(String... args) throws IOException {
        String input = "sample1.xlsx";
        Path inputFile = Utils.getPath(GetFirstCellWorksheet.class, input);

        String sheetName = "Sheet1";
        String cellOrMethodName = "firstcell";

        Utils.getStorageSdk().PutCreate(
                input,
                null,
                Utils.STORAGE,
                inputFile.toFile()
        );

        com.aspose.cells.model.CellResponse apiResponse
                = Utils.getCellsSdk().GetWorksheetCell(
                        input,
                        sheetName,
                        cellOrMethodName,
                        Utils.STORAGE,
                        Utils.FOLDER
                );
        com.aspose.cells.model.Cell cell = apiResponse.getCell();
        System.out.println("Cell Name :: " + cell.getName());
        System.out.println("Cell Value :: " + cell.getValue());
    }
}


text:
require 'faraday'
require 'faraday_middleware'

require 'oauth2'

# Public: The Mirror API client.
#
# It should be instanciated with the user's access token.
class Glass::Client
	attr_reader :base_uri, :conn, :client_id, :client_secret

	# Public: Create a new Mirror API client.
	#
	# "client_id" and "client_secret" are only required when performing
	# authorization with the client, otherwise
	# only the "token" is required.
	#
	# token - A user access token.
	# client_id - (optional) Application's client ID.
	# client_secret - (optional) Application's client secret.
	#
	# Returns a Glass::Client bound to this token.
	def initialize(token = nil, client_id: nil, client_secret: nil)
		@client_id, @client_secret = client_id, client_secret

		@base_uri = 'https://www.googleapis.com/mirror/v1'

		@conn = Faraday.new(url: @base_uri) do |conn|
			conn.request :bearer_token, token
			conn.request :json
			conn.request :multipart

			conn.response :json, content_type: 'application/json'
			# FIXME: Looks like it isn't called, but this is not really a problem.
			conn.response :mashify

			conn.adapter Faraday.default_adapter
		end
	end

	# Public: Access the Timeline API resource.
	def timeline
		@timeline_api ||= Glass::Api::Timeline.new(self)
	end

	# Public: Access the Subscriptions API resource.
	def subscriptions
		@subscriptions_api ||= Glass::Api::Subscriptions.new(self)
	end

	# Public: Access the Locations API resource.
	def locations
		@locations_api ||= Glass::Api::Locations.new(self)
	end

	# Public: Access the Contacts API resource.
	def contacts
		@contacts_api ||= Glass::Api::Contacts.new(self)
	end

	# Public: Access the Accounts API resource.
	def accounts
		@accounts_api ||= Glass::Api::Accounts.new(self)
	end

	# Public: Access the Settings API resource.
	def settings
		@settings_api ||= Glass::Api::Settings.new(self)
	end

	# Public: Perform a GET request through Faraday.
	def get(*args)
		conn.get(*args)
	end

	# Public: Perform a POST request through Faraday.
	def post(*args)
		conn.post(*args)
	end

	# Public: Perform a PUT request through Faraday.
	def put(*args)
		conn.put(*args)
	end

	# Public: Perform a PATCH request through Faraday.
	def patch(*args)
		conn.patch(*args)
	end

	# Public: Perform a DELETE request through Faraday.
	def delete(*args)
		conn.delete(*args)
	end

	# Public: Returns an authorization url using provided
	# client_id and client_secret.
	def authorize
		oauth_client.auth_code.authorize_url(authorize_params(scopes))
	end

	# Public: Return an OAuth2::AccessToken using the given code.
	#
	# code - The code retrieved after authorization.
	def get_token(code)
		oauth_client.auth_code.get_token(code, get_token_params)
	end

	private

	# Internal: The OAuth2::Client used for authorization.
	def oauth_client
		@oauth_client ||= OAuth2::Client.new(@client_id, @client_secret, oauth_client_options)
	end

	# Internal: OAuth2::Client initialization options.
	def oauth_client_options
		{
			site: 'https://accounts.google.com',
			authorize_url: '/o/oauth2/auth',
			token_url: '/o/oauth2/token'
		}
	end

	# Internal: OAuth2 authorization parameters.
	def authorize_params(scopes)
		{
			scope: scopes.map(&method(:build_scope)).join(' '),
			redirect_uri: callback_url
		}
	end

	# Internal: Prepend's the base_scope_url to the given
	# scope if necessary.
	def build_scope(scope)
		unless scope =~ /^https?:\/\//
			"#{base_scope_url}#{scope}"
		else
			scope
		end
	end

	# Internal: Scopes required to access the Mirror API.
	def scopes
		%w(glass.timeline glass.location)
	end

	# Internal: OAuth2 get_token parameters.
	def get_token_params
		{
			redirect_uri: callback_url
		}
	end

	# Internal: The OAuth2 callback url to use.
	#
	# "oob" is a convenient value during development because
	# the user is redirected to a page where he can copy the
	# authorization code.
	#
	# TODO: Parameterize the callback url.
	def callback_url
		'oob'
	end

	# Internal: The base url used in Google API scopes.
	def base_scope_url
		'https://www.googleapis.com/auth/'
	end
end


text:
package com.stratio.crossdata.driver

import java.nio.file.Paths

import com.stratio.crossdata.common.QueryCancelledReply
import com.stratio.crossdata.common.result.{ErrorSQLResult, SuccessfulSQLResult}
import com.stratio.crossdata.driver.test.Utils._
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.concurrent.ScalaFutures

import scala.concurrent.Await
import scala.concurrent.duration._
import scala.language.postfixOps
import scala.reflect.io.File

@RunWith(classOf[JUnitRunner])
class DriverIT extends EndToEndTest with ScalaFutures {

  driverFactories foreach { case (factory, description) =>

    implicit val ctx = DriverTestContext(factory)

    val factoryDesc = s" $description"

    "CrossdataDriver" should "return an ErrorResult when running an unparseable query" + factoryDesc in {

      assumeCrossdataUpAndRunning()
      withDriverDo { driver =>

        val result = driver.sql("select select").waitForResult(10 seconds)
        result shouldBe an[ErrorSQLResult]
        result.asInstanceOf[ErrorSQLResult].message should include regex "cannot resolve .*"
      }
    }

    it should "return a SuccessfulQueryResult when executing a select *" + factoryDesc in {
      assumeCrossdataUpAndRunning()
      withDriverDo { driver =>

        driver.sql(s"CREATE TEMPORARY TABLE jsonTable USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')").waitForResult()

        val result = driver.sql("SELECT * FROM jsonTable").waitForResult()

        result shouldBe an[SuccessfulSQLResult]
        result.hasError should be(false)
        val rows = result.resultSet
        rows should have length 2
        rows(0) should have length 2
      }
    }

    it should "get a list of tables" + factoryDesc in {
      assumeCrossdataUpAndRunning
      withDriverDo { driver =>

        driver.sql(
          s"CREATE TABLE db.jsonTable2 USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')"
        ).waitForResult()

        driver.sql(
          s"CREATE TABLE jsonTable2 USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')"
        ).waitForResult()

        driver.listTables() should contain allOf(("jsonTable2", Some("db")), ("jsonTable2", None))
      }
    }

    it should "indicates that the cluster is alive when there is a server up" + factoryDesc in {
      withDriverDo { driver =>

        driver.isClusterAlive(6 seconds) shouldBe true
      }
    }

    it should "return the addresses of servers up and running" + factoryDesc in {
      withDriverDo { driver =>

        val addresses = Await.result(driver.serversUp(), 6 seconds)

        addresses should have size 1
        addresses.head.host shouldBe Some("127.0.0.1")
      }
    }

    it should "return the current cluster state" + factoryDesc in {
      withDriverDo { driver =>

        val clusterState = Await.result(driver.clusterState(), 6 seconds)

        clusterState.getLeader.host shouldBe Some("127.0.0.1")
      }
    }

    //TODO: Enable this tests
    it should "be able to execute ADD JAR Command of an existent file" + factoryDesc ignore {
      // TODO restore before merging session to master
      assumeCrossdataUpAndRunning

      val file = File(s"/tmp/bulk_${System.currentTimeMillis()}.jar").createFile(false)
      withDriverDo { driver =>
        val result = driver.addJar(file.path).waitForResult()
        file.delete()
        result.hasError should equal(false)
      }

    }

    //TODO: Enable this test
    it should "be return an Error when execute ADD JAR Command of an un-existent file" + factoryDesc ignore {

      withDriverDo { driver =>
        val result = driver.addJar(s"/tmp/jarnotexists").waitForResult()
        result.hasError should equal(true)
      }
    }

    it should "be able to execute ADD APP Command of an existent file" + factoryDesc ignore {
      assumeCrossdataUpAndRunning

      val filePath = getClass.getResource("/TestAddApp.jar").getPath
      withDriverDo { driver =>
        val result = driver.addAppCommand(filePath, "com.stratio.addApp.AddAppTest.main", Some("testApp")).waitForResult()
        driver.sql("EXECUTE testApp(rain,bow)").waitForResult()
        result.hasError should equal(false)
      }

    }

    it should "be able to execute ADD APP Command of an existent file with options" + factoryDesc ignore {
      assumeCrossdataUpAndRunning

      val filePath = getClass.getResource("/TestAddApp.jar").getPath

      withDriverDo { driver =>
        val addAppResult = driver.addAppCommand(filePath, "com.stratio.addApp.AddAppTest.main", Some("testApp")).waitForResult()
        addAppResult.hasError should equal(false)

        val executeResult = driver.sql("""EXECUTE testApp(rain,bow2) OPTIONS (executor.memory '20G')""").waitForResult()

        executeResult.hasError should equal(false)
        executeResult.resultSet.length should equal(1)
        executeResult.resultSet(0).get(0) should equal("Spark app launched")

      }
    }

    it should "allow running multiple drivers per JVM" + factoryDesc in {

      val driverTable = "drvtable"
      val anotherDriverTable = "anotherTable"

      withDriverDo { driver =>
        withDriverDo { anotherDriver =>
          driver shouldNot be theSameInstanceAs anotherDriver
          driver.listTables().size shouldBe anotherDriver.listTables().size

          driver.sql(s"CREATE TEMPORARY TABLE $driverTable USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')").waitForResult()
          driver.sql(s"SELECT * FROM $driverTable").waitForResult().resultSet should not be empty
          anotherDriver.sql(s"SELECT * FROM $driverTable").waitForResult().hasError shouldBe true

          anotherDriver.sql(s"CREATE TEMPORARY TABLE $anotherDriverTable USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')").waitForResult()
          anotherDriver.sql(s"SELECT * FROM $anotherDriverTable").waitForResult().resultSet should not be empty
          driver.sql(s"SELECT * FROM $anotherDriverTable").waitForResult().hasError shouldBe true

        }
        // Once 'anotherDriver' closes its session, 'driver' should be still alive
        driver.sql(s"SELECT * FROM $driverTable").waitForResult().resultSet should not be empty
        driver.sql(s"SELECT * FROM $anotherDriverTable").waitForResult().hasError shouldBe true
      }
    }

    it should "be able to cancel queries" + factoryDesc ignore {
      assumeCrossdataUpAndRunning()

      withDriverDo { driver =>

        driver.sql(s"CREATE TEMPORARY TABLE jsonTable USING org.apache.spark.sql.json OPTIONS (path '${Paths.get(getClass.getResource("/tabletest.json").toURI).toString}')").waitForResult()

        val queryRq = driver.sql("SELECT DEBUG_SLEEP_MS(2000) FROM jsonTable")
        val cancellationResponseFuture = queryRq.cancelCommand()

        whenReady(cancellationResponseFuture) { res =>
          res shouldBe a[QueryCancelledReply]
        } (PatienceConfig(timeout = 3 seconds))

      }

    }

  }

}


text:
/**
 * Flatten an array indefinitely.
 */
export function flatten(array) {
    var result = [];
    $flatten(array, result);
    return result;
}
/**
 * Internal flatten function recursively passes `result`.
 */
function $flatten(array, result) {
    for (var i = 0; i < array.length; i++) {
        var value = array[i];
        if (Array.isArray(value)) {
            $flatten(value, result);
        }
        else {
            result.push(value);
        }
    }
}
//# sourceMappingURL=index.js.map