text:
@implementation lwTitleCell

{
    //  标题label
    UILabel *titleLabel;
    //  价格label
    UILabel *priceLabel;
    // 提醒label
    UIButton *alertButton;
    //  原价label
    UILabel *originalPriceLabel;
    //  定制标签
    UIButton *customLabel;
}

- (UITableViewCell *)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupView];
    }
    return self;
}

- (void)setupView{
    // 标题
    titleLabel = [[UILabel alloc] init];
    titleLabel.text =  @"家の物语 日本进口密封保鲜盒不粘底饺子盒 冰箱冷藏收纳盒 食品便当盒 2个装白色";
    titleLabel.font = [UIFont systemFontOfSize:16.0];
    titleLabel.textColor = [UIColor blackColor];
    titleLabel.numberOfLines = 0;
    [self.contentView addSubview:titleLabel];

    // 提醒标签(不一定有)
    alertButton = [[UIButton alloc] init];
    [alertButton setAttributedTitle:[self underline:@"好货提前抢 全场买4免1 数量有限赶紧抢 更多好品点击这里"] forState:UIControlStateNormal];
    [alertButton setTitleColor:[lwStyleTool colorInstance].JDColor forState:UIControlStateNormal];
    [alertButton setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
    [alertButton.titleLabel setNumberOfLines:0];
    [alertButton.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    [alertButton setTag:alertButtonTag];
    [self.contentView addSubview:alertButton];

    // 价格标签
    priceLabel = [[UILabel alloc] init];
    priceLabel.text = @"¥ 19.00";
    priceLabel.font = [UIFont systemFontOfSize:19.0];
    priceLabel.textColor = [lwStyleTool colorInstance].JDColor;
    [self.contentView addSubview:priceLabel];

    // 原价标签
    originalPriceLabel = [[UILabel alloc] init];

    NSAttributedString *at = [[NSAttributedString alloc] initWithString:@"原价:¥ 29.00" attributes:@{NSForegroundColorAttributeName:[UIColor lightGrayColor],NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle|NSUnderlinePatternSolid),NSStrikethroughColorAttributeName:[UIColor lightGrayColor]}];
    originalPriceLabel.attributedText = at;
    originalPriceLabel.font = [UIFont systemFontOfSize:14.0];
    originalPriceLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:originalPriceLabel];

    customLabel = [[UIButton alloc] init];
    [customLabel setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
    [customLabel setTitle:@"  比PC端省13.3元 " forState:UIControlStateNormal];
    [customLabel setImage:[UIImage imageNamed:@"zx"] forState:UIControlStateNormal];
    [customLabel.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
    [customLabel setTitleEdgeInsets:UIEdgeInsetsMake(8, 8, 8, 8)];
    [customLabel setTitleColor:[lwStyleTool colorInstance].JDColor forState:UIControlStateNormal];;
    [self.contentView addSubview:customLabel];

    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(padding);
        make.right.mas_equalTo(-padding);
        make.top.mas_equalTo(padding);
        make.bottom.mas_equalTo(alertButton.mas_top).with.offset(-padding);
    }];

    [alertButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(padding);
        make.top.mas_equalTo(titleLabel.mas_bottom).with.offset(padding);
        make.right.mas_equalTo(-padding);
        make.bottom.mas_equalTo(priceLabel.mas_top).with.offset(-padding);
    }];

    [priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(padding);
        make.top.mas_equalTo(alertButton.mas_bottom).with.offset(padding);
        make.right.mas_equalTo(originalPriceLabel.mas_left).with.offset(-padding);
        make.bottom.mas_equalTo(customLabel.mas_top).with.offset(-padding);
        make.height.mas_equalTo(originalPriceLabel.mas_height);
        make.width.mas_equalTo(originalPriceLabel.mas_width);
    }];

    [originalPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(priceLabel.mas_right).with.offset(padding);
        make.top.mas_equalTo(alertButton.mas_bottom).with.offset(padding);
        make.right.mas_equalTo(-padding);
        make.bottom.mas_equalTo(customLabel.mas_top).with.offset(-padding);
        make.height.mas_equalTo(priceLabel.mas_height);
        make.width.mas_equalTo(priceLabel.mas_width);
    }];

    [customLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(padding);
        make.top.mas_equalTo(priceLabel.mas_bottom).with.offset(padding);
        make.right.mas_equalTo(-padding);
        make.bottom.mas_equalTo(-padding);
        make.height.mas_equalTo(31);
    }];
}

- (NSAttributedString *)underline:(NSString *)string{
    NSAttributedString *str = [[NSAttributedString alloc]initWithString:string
                                                             attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.f],
                                                                          NSForegroundColorAttributeName:[lwStyleTool colorInstance].JDColor,
                                                                          NSUnderlineStyleAttributeName:@(NSUnderlineStyleSingle),
                                                                          NSStrikethroughColorAttributeName:[lwStyleTool colorInstance].JDColor}];
    return str;
}

@end


text:
using System;
using System.Linq;

namespace Microsoft.Azure.Management.RecoveryServices.Backup.Models
{
    /// <summary>
    /// Base class for protected item.
    /// </summary>
    public partial class ProtectedItemBase
    {
        /// <summary>
        /// Initializes a new instance of the ProtectedItemBase class.
        /// </summary>
        public ProtectedItemBase()
        {
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

$loader = @include __DIR__ . '/vendor/autoload.php';
if (!$loader) {
    $loader = require __DIR__ . './vendor/autoload.php';
}
$loader->addPsr4('phparia\\Tests\\Functional\\', __DIR__);


text:
package th.in.llun.thorfun.api;

import android.util.Log;

public class DefaultApiResponse<E extends Object> implements ApiResponse<E> {

	@Override
	public void onError(Exception exception) {
		Log.e(Thorfun.LOG_TAG, "Error response", exception);
	}

	@Override
	public void onResponse(E result) {
		Log.v(Thorfun.LOG_TAG, "Result: " + result.toString());
	}

}


text:
'use strict';

// Declare app level module which depends on views, and components
angular.module('myApp', [
    'ngRoute',
    'ui-notification',
    'myApp.home',
    'myApp.wallets',
    'myApp.settings',
    'myApp.version',
    'myApp.buy',
    'myApp.sell',
    'myApp.enabledExchanges',
    'myApp.buyOrders',
    'myApp.sellOrders',
    'myApp.stringUtils',
    'myApp.webSocket'
]).
config(['$locationProvider', '$routeProvider', 'NotificationProvider', function($locationProvider, $routeProvider, NotificationProvider) {
    NotificationProvider.setOptions({
        delay: 5000,
        startTop: 60,
        startRight: 10,
        verticalSpacing: 10,
        horizontalSpacing: 20,
        positionX: 'right',
        positionY: 'top'
    });

    $locationProvider.hashPrefix('!');

    $routeProvider.otherwise({ redirectTo: '/' });
}]);


text:
'use strict';

const assert = require('assert');

const MySensorsMessageTypes = require('./MySensorsMessageTypes.js');
const MySensorsInternalSubTypes = require('./MySensorsInternalSubTypes.js');
const MySensorsSetReqSubTypes = require('./MySensorsSetReqSubTypes.js');
const MySensorsPresentationSubTypes = require('./MySensorsPresentationSubTypes.js');
const formatStringTemplate = require("string-template")

const SIX_FIELD_MESSAGE = {
	FIELD_NODE_ID : 0,
	FIELD_CHILD_SENSOR_ID : 1,
	FIELD_MESSAGE_TYPE : 2,
	FIELD_ACKNOWLEDGE : 3,
	FIELD_SUBTYPE : 4,
	FIELD_PAYLOAD : 5
};

const SEVEN_FIELD_MESSAGE = {
	FIELD_OCCURENCE_DATE: 0,
	FIELD_NODE_ID : 1,
	FIELD_CHILD_SENSOR_ID : 2,
	FIELD_MESSAGE_TYPE : 3,
	FIELD_ACKNOWLEDGE : 4,
	FIELD_SUBTYPE : 5,
	FIELD_PAYLOAD : 6
};

class MySensorsMessage {

	/**
	 * Represents a MySensor Message and is able to parse the raw string as well as create a response message
	 * @param {string|MySensorMessage} [rawInput] - The input to initialize the message. This can be a string as incoming message or another MySensorMessage to create a clone
	 */
	constructor(rawInput) {
		/**
		 * This is the identifier of the node
		 * @type {number}
		 */
		this.nodeId = 0;

		/**
		 * Identifier of the sensor attached to the node
		 * @type {number}
		 */
		this.childSensorId = 0;

		/**
		 * The message type which was send by the node
		 * @type {MySensorsMessageTypes}
		 */
		this.messageType = null;

		/**
		 * The ack parameter has the following meaning:
		 * Outgoing: false = unacknowledged message, true = request ack from destination node
		 * Incoming: false = normal message, true = this is an ack message
		 * @type {boolean}
		 */
		this.isAcknowledged = false;

		/**
		 * Depending on messageType this field has different meaning
		 * @type {null}
		 */
		this.subType = null;

		/**
		 * The payload holds the message coming in from sensors or instruction going out to actuators.
		 * @type {string}
		 */
		this.payload = "";

		/**
		 *
		 * @type {Date}
		 */
		this.occurenceDate = new Date();

		//Read input and initialize object
		if (rawInput instanceof Uint8Array)
		{
			this.parseInput(inputStreamtoString(rawInput));
		}
		else if (rawInput instanceof String || typeof rawInput === 'string')
		{
			this.parseInput(rawInput);
		}
		else if (rawInput instanceof MySensorsMessage)
		{
			for (let otherMySensorsAttribute in rawInput)
			{
				this[otherMySensorsAttribute] = rawInput[otherMySensorsAttribute];
			}
		}
		else if (typeof rawInput === 'object')
		{
			this.nodeId = rawInput.nodeId;
			this.childSensorId = rawInput.childSensorId;
			this.messageType = MySensorsMessageTypes[rawInput.messageType];
			this.payload = rawInput.payload || "";

			this.isAcknowledged = rawInput.isAcknowledged;
			if (this.messageType === MySensorsMessageTypes.PRESENTATION)
			{
				this.subType = MySensorsPresentationSubTypes[rawInput.subType];
			}
			else if (this.messageType === MySensorsMessageTypes.REQ || this.messageType === MySensorsMessageTypes.SET)
			{
				this.subType = MySensorsSetReqSubTypes[rawInput.subType];
			}
			else if (this.messageType === MySensorsMessageTypes.INTERNAL)
			{
				this.subType = MySensorsInternalSubTypes[rawInput.subType];
			}
		}
	}

	toObject() {
		return {
			nodeId: this.nodeId,
			childSensorId: this.childSensorId,
			messageType: this.messageType.id,
			payload: this.payload,
			isAcknowledged: this.isAcknowledged,
			subType: this.subType.id
		};
	}

	parseInput(inputMessages) {
		inputMessages = inputMessages.split("\n");
		let inputMessageParts = inputMessages[0].split(";");

		//The input message needs 6 or 7 fields to continue
		assert(inputMessageParts.length == 6 || inputMessageParts.length == 7, "It was expected that the input message contains 6 or 7 fields.");

		//Six field messages are default
		let fieldsMessage = SIX_FIELD_MESSAGE;
		//In case it's a 7 field message the occurence date is part of the message
		if(inputMessageParts.length == 7)
		{
			fieldsMessage = SEVEN_FIELD_MESSAGE;
			this.occurenceDate = new Date(inputMessageParts[fieldsMessage.FIELD_OCCURENCE_DATE]);
		}

		this.nodeId = parseInt(inputMessageParts[fieldsMessage.FIELD_NODE_ID]);
		this.childSensorId = parseInt(inputMessageParts[fieldsMessage.FIELD_CHILD_SENSOR_ID]);
		this.messageType = MySensorsMessageTypes.lookupType(inputMessageParts[fieldsMessage.FIELD_MESSAGE_TYPE]);
		this.isAcknowledged = inputMessageParts[fieldsMessage.FIELD_ACKNOWLEDGE] == "1";
		if (this.messageType == MySensorsMessageTypes.PRESENTATION)
		{
			this.subType = MySensorsPresentationSubTypes.lookupType(inputMessageParts[fieldsMessage.FIELD_SUBTYPE]);
		}
		else if (this.messageType == MySensorsMessageTypes.REQ || this.messageType == MySensorsMessageTypes.SET)
		{
			this.subType = MySensorsSetReqSubTypes.lookupType(inputMessageParts[fieldsMessage.FIELD_SUBTYPE]);
		}
		else if (this.messageType == MySensorsMessageTypes.INTERNAL)
		{
			this.subType = MySensorsInternalSubTypes.lookupType(inputMessageParts[fieldsMessage.FIELD_SUBTYPE]);
		}
		this.payload = inputMessageParts[fieldsMessage.FIELD_PAYLOAD];
	}

	isGatewayReadyMessage() {
		return this.nodeId === 0 && this.childSensorId === 0 && this.messageType == MySensorsMessageTypes.INTERNAL && this.subType === MySensorsInternalSubTypes.I_GATEWAY_READY;
	}

	isNodeIDRequest() {
		return this.nodeId === MySensorsMessage.BROADCAST_NODE_ID && this.childSensorId === MySensorsMessage.CHILD_SENSOR_ID_ON_CONFIG && this.messageType == MySensorsMessageTypes.INTERNAL && this.subType === MySensorsInternalSubTypes.I_ID_REQUEST;
	}

	isNodeTypePresentation() {
		return this.childSensorId === MySensorsMessage.CHILD_SENSOR_ID_ON_CONFIG && this.messageType === MySensorsMessageTypes.PRESENTATION;
	}

	isNodeSketchInfo() {
		return this.nodeId !== MySensorsMessage.BROADCAST_NODE_ID && this.childSensorId === MySensorsMessage.CHILD_SENSOR_ID_ON_CONFIG && this.messageType === MySensorsMessageTypes.INTERNAL;
	}

	isNodeSensorPresentation() {
		return this.childSensorId !== MySensorsMessage.CHILD_SENSOR_ID_ON_CONFIG && this.messageType === MySensorsMessageTypes.PRESENTATION;
	}

	toString(includingDate) {
		let mySensorsMessage = [];

		if(includingDate === true)
		{
			let occurrenceDate = new Date();
			if(this.occurenceDate instanceof Date)
			{
				occurrenceDate = this.occurenceDate;
			}
			let occurrenceDateString = JSON.stringify(occurrenceDate).substr(1,24);
			mySensorsMessage.push(occurrenceDateString);
		}

		mySensorsMessage.push(this.nodeId);
		mySensorsMessage.push(this.childSensorId);
		mySensorsMessage.push(this.messageType.value);
		mySensorsMessage.push(this.isAcknowledged ? "1" : "0");
		mySensorsMessage.push(this.subType.value);
		mySensorsMessage.push(this.payload);

		return mySensorsMessage.join(";") + "\n";
	}

	format(formatString) {
		return formatStringTemplate(formatString, this);
	}

}

MySensorsMessage.BROADCAST_NODE_ID = 255;
MySensorsMessage.CHILD_SENSOR_ID_ON_CONFIG = 255;
MySensorsMessage.MySensorsMessageTypes = MySensorsMessageTypes;
MySensorsMessage.MySensorsInternalSubTypes = MySensorsInternalSubTypes;
MySensorsMessage.MySensorsSetReqSubTypes = MySensorsSetReqSubTypes;
MySensorsMessage.MySensorsPresentationSubTypes = MySensorsPresentationSubTypes;

Object.freeze(MySensorsMessage);

module.exports = MySensorsMessage;

const inputStreamtoString = function(buf) {
	return String.fromCharCode.apply(null, new Uint16Array(buf));
};

const stringEndsWith = function(string, suffix) {
	return string.indexOf(suffix, string.length - suffix.length) !== -1;
};


text:
.table-view {
    -fx-background-color: transparent;
    -fx-border-color: transparent;
    -fx-border-width: 0 0 0 0;
    -fx-background-insets: 0 0 0 0;
    -fx-background-radius: 0 0 0 0;
    -fx-focus-color: transparent;
}

.table-view .column-header, .table-view .column-header-background {
    -fx-background-color: white;
}

.table-view .column-header {
    -fx-pref-height: 50;
}

.column-header > .label {
    -fx-alignment: CENTER-LEFT;
}

.textColumn, .numberColumn {
    -fx-alignment: CENTER-LEFT;
    -fx-padding: 0 10 0 10;
}

.firstColumn {
    -fx-alignment: CENTER-LEFT;
    -fx-padding: 0 10 0 0;
}

.playingColumn {
    -fx-alignment: CENTER-LEFT;
    -fx-padding: 0 0 0 0;
}

.table-view .column-header .text {
    -fx-font-family: verdana;
    -fx-font-size: 18px;
    -fx-font-weight: normal;
}

.table-cell, .table-row-cell {
    -fx-border-color: transparent;
    -fx-border-width: 0 0 0 0;
}

.table-row-cell .text {
    -fx-font-family: verdana;
    -fx-font-size: 12px;
    -fx-font-weight: normal;
    -fx-fill: black;
}

.table-row-cell:even {
    -fx-background-color: #f2f2f2;
}

.table-row-cell:odd {
    -fx-background-color: white;
}

.table-row-cell:filled:selected:focused, .table-row-cell:filled:selected {
    -fx-background-color: rgb(52, 109, 207);
}

.table-row-cell:filled:selected:focused:hover, .table-row-cell:filled:selected:hover {
    -fx-background-color: rgb(47, 98, 187);
}

.table-row-cell:filled:selected .text, .table-row-cell:filled:selected:hover .text {
    -fx-fill: white;
}

.table-row-cell:filled:hover {
    -fx-background-color: #dadada;
}

.table-row-cell:playing .text {
    -fx-fill: rgb(52, 109, 207);
}

.table-row-cell > .table-cell > .iconContainer > .icon {
    -fx-fill: rgb(52, 109, 207);
}

.table-row-cell:filled:selected:focused > .table-cell > .iconContainer > .icon,
.table-row-cell:filled:selected > .table-cell > .iconContainer > .icon {
    -fx-fill: white;
}

.table-view .scroll-bar {
    -fx-padding: 0 0 0 25;
    -fx-background-color: transparent;
}

.table-view .scroll-bar:vertical .increment-button,
.table-view .scroll-bar:vertical .decrement-button,
.table-view .scroll-bar:vertical .increment-arrow,
.table-view .scroll-bar:vertical .decrement-arrow {
    -fx-pref-height: 0;
    -fx-padding: 3;
}

.table-view .scroll-bar:vertical .track {
    -fx-background-color: #f2f2f2;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
}

.table-view .scroll-bar:vertical .thumb {
    -fx-background-color: #dadada;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
}

.table-view .scroll-bar:vertical .thumb:hover {
    -fx-background-color: #c2c2c2;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
}

.table-view .scroll-bar:horizontal .increment-button,
.table-view .scroll-bar:horizontal .decrement-button,
.table-view .scroll-bar:horizontal .increment-arrow,
.table-view .scroll-bar:horizontal .decrement-arrow {
    -fx-background-color: transparent;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
    -fx-padding: 0;
    -fx-shape: null;
    -fx-border-width: 0;
    -fx-border-color: transparent;
    visibility: hidden;
}


text:
<?php
/********************************************************/
/********************************************************/
/* Event Calendar                                       */
/* Written by: Rob Sutton                               */
/* http://www.xnettech.com (My Consulting Company)      */
/* http://smart.xnettech.net (My Nuke Site)             */
/*                                                      */
/* This program is opensource so you can do whatever    */
/* you want with it.                                    */
/********************************************************/
/********************************************************/

if (!eregi("admin.php", $PHP_SELF)) { die ("Access Denied"); }

switch($op) {

    case "CalendarAdmin":
    include("admin/modules/calendar.php");
    break;

    case "CalendarDisplayStory":
    include("admin/modules/calendar.php");
    break;

    case "CalendarPreviewAgain":
    include("admin/modules/calendar.php");
    break;

    case "CalendarPostStory":
    include("admin/modules/calendar.php");
    break;

    case "CalendarEditStory":
    include("admin/modules/calendar.php");
    break;

    case "CalendarRemoveStory":
    include("admin/modules/calendar.php");
    break;

    case "CalendarChangeStory":
    include("admin/modules/calendar.php");
    break;

    case "CalendarDeleteStory":
    include("admin/modules/calendar.php");
    break;
}

?>


text:
The Minecraft Dead
==================

a CraftBukkit MiniGame Plugin like the Walking Dead

**Links**
* **BukkitDev** http://dev.bukkit.org/server-mods/the-minecraft-dead/


text:
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

using VsChromium.Core.Files;

namespace VsChromium.Server.Projects {
  public interface ISearchableFilesFilter {
    bool Include(RelativePath fileName);
  }
}


text:
class Forge::ProductCategoriesController < ForgeController
  load_and_authorize_resource

  def index
    respond_to do |format|
      format.html {
        @product_categories = ProductCategory.paginate(:per_page => 10, :page => params[:page])
        @product_category = ProductCategory.new
      }
      format.js {
        @product_categories = ProductCategory.where("title LIKE ?", "%#{params[:q]}%")
        render :partial => "product_category", :collection => @product_categories
      }
    end
  end

  def edit
    respond_to do |format|
      format.html {}
      format.js { render :layout => false }
    end
  end

  def create
    @product_category = ProductCategory.new(params[:product_category])
    if @product_category.save
      flash[:notice] = 'Product category was successfully created.'
      redirect_to(forge_product_categories_path)
    else
      render :action => :index
    end
  end

  def update
    if @product_category.update_attributes(params[:product_category])
      flash[:notice] = 'Product category was successfully updated.'
      redirect_to(forge_product_categories_path)
    else
      render :action => "edit"
    end
  end

  def destroy
    @product_category.destroy
    redirect_to(forge_product_categories_path)
  end

  def reorder
    ProductCategory.reorder!(params[:product_category_list])
    respond_to do |format|
      format.js { render :nothing => true }
      format.html { redirect_to :action => :index }
    end
  end
end


text:
/**
 * @author Bart Whiteley
 * @author Dan Nuffer
 */

#include "OW_CppProviderIncludes.hpp"

#include "OW_Exec.hpp"
#include "OW_UnnamedPipe.hpp"
#include "OW_SocketAddress.hpp"

#include <iostream> // for cerr
#include <sys/types.h>
#include <signal.h>

using namespace OpenWBEM;
using namespace WBEMFlags;

namespace
{
class LinuxProcess : public CppInstanceProviderIFC,
	public CppMethodProviderIFC, public CppIndicationProviderIFC
{
public:

	////////////////////////////////////////////////////////////////////////////
	virtual ~LinuxProcess()
	{
	}

	////////////////////////////////////////////////////////////////////////////
	virtual void enumInstanceNames(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const String& className,
		CIMObjectPathResultHandlerIFC& result,
		const CIMClass& cimClass )
	{
		String cmd = "/bin/ps ax --no-heading -eo pid,comm,vsz";
		PopenStreams pos = Exec::safePopen(cmd.tokenize());

		String output = pos.out()->readAll();

		if (pos.getExitStatus() != 0)
		{
			//OW_THROWCIMMSG(CIMException::FAILED, "Bad exit status from popen");
		}

		StringArray lines = output.tokenize("\n");
		for (StringArray::const_iterator iter = lines.begin();
			iter != lines.end(); iter++)
		{
			StringArray proc = iter->tokenize();
			CIMObjectPath newCop(className, ns);
			newCop.setKeyValue(String("Handle"), CIMValue(proc[0]));
			newCop.setKeyValue(String("CreationClassName"),
				CIMValue(className));
			newCop.setKeyValue(String("OSName"), CIMValue(String("Linux")));
			newCop.setKeyValue(String("OSCreationClassName"),
				CIMValue(String("CIM_OperatingSystem")));
			newCop.setKeyValue(String("CSName"),
				CIMValue(SocketAddress::getAnyLocalHost().getName()));
			newCop.setKeyValue(String("CSCreationClassName"),
				CIMValue(String("CIM_ComputerSystem")));
			result.handle(newCop);
		}
	}

	////////////////////////////////////////////////////////////////////////////
	virtual void enumInstances(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const String& className,
		CIMInstanceResultHandlerIFC& result,
		ELocalOnlyFlag localOnly,
		EDeepFlag deep,
		EIncludeQualifiersFlag includeQualifiers,
		EIncludeClassOriginFlag includeClassOrigin,
		const StringArray* propertyList,
		const CIMClass& requestedClass,
		const CIMClass& cimClass )
	{
		String cmd = "/bin/ps ax --no-heading -eo pid,vsize,pcpu,comm";
		PopenStreams pos = Exec::safePopen(cmd.tokenize());
		String output = pos.out()->readAll();
		if (pos.getExitStatus() != 0)
		{
			OW_THROWCIMMSG(CIMException::FAILED, "Bad exit status from popen");
		}

		StringArray lines = output.tokenize("\n");
		for (StringArray::const_iterator iter = lines.begin();
			iter != lines.end(); iter++)
		{
			StringArray proc = iter->tokenize();
			CIMInstance newInst = cimClass.newInstance();
			newInst.setProperty(String("CreationClassName"),
				CIMValue(className));
			newInst.setProperty(String("Handle"), CIMValue(proc[0]));
			newInst.setProperty(String("OSName"), CIMValue(String("Linux")));
			newInst.setProperty(String("OSCreationClassName"),
				CIMValue(String("CIM_OperatingSystem")));
			newInst.setProperty(String("CSName"),
				CIMValue(SocketAddress::getAnyLocalHost().getName()));
			newInst.setProperty(String("CSCreationClassName"),
				CIMValue(String("CIM_ComputerSystem")));
			newInst.setProperty(String("Name"), CIMValue(proc[3]));
			try
			{
				newInst.setProperty(String("VirtualMemorySize"), CIMValue(proc[1].toUInt32()));
				newInst.setProperty(String("PercentCPU"), CIMValue(proc[2].toReal32()));
			}
			catch (const StringConversionException& e)
			{
				OW_THROWCIMMSG_SUBEX(CIMException::FAILED, "Provider failed parsing output from ps", e);
			}
			result.handle(newInst.clone(localOnly,deep,includeQualifiers,
				includeClassOrigin,propertyList,requestedClass,cimClass));
		}
	}

	////////////////////////////////////////////////////////////////////////////
	virtual CIMInstance getInstance(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const CIMObjectPath& instanceName,
		ELocalOnlyFlag localOnly,
		EIncludeQualifiersFlag includeQualifiers,
		EIncludeClassOriginFlag includeClassOrigin,
		const StringArray* propertyList,
		const CIMClass& cimClass )
	{
		CIMInstance inst = cimClass.newInstance();
		inst.updatePropertyValues(instanceName.getKeys());
		String pid;
		inst.getProperty("Handle").getValue().get(pid);
		String cmd("/bin/ps p ");
		cmd += pid;
		cmd += " --no-headers -o vsize,pcpu,comm";
		PopenStreams pos = Exec::safePopen(cmd.tokenize());
		StringArray proc = pos.out()->readAll().tokenize();
		if (pos.getExitStatus() != 0)
		{
			OW_THROWCIMMSG(CIMException::NOT_FOUND,
				"The Instance does not (any longer) exist");
		}
		inst.setProperty(String("Name"), CIMValue(proc[2]));
		try
		{
			inst.setProperty(String("VirtualMemorySize"), CIMValue(proc[0].toUInt32()));
			inst.setProperty(String("PercentCPU"), CIMValue(proc[1].toReal32()));
		}
		catch (const StringConversionException& e)
		{
			OW_THROWCIMMSG_SUBEX(CIMException::FAILED, "Provider failed parsing output from ps", e);
		}
		return inst.clone(localOnly,includeQualifiers,includeClassOrigin,propertyList);
	}

	////////////////////////////////////////////////////////////////////////////
	virtual CIMObjectPath createInstance(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const CIMInstance& cimInstance )
	{
		OW_THROWCIMMSG(CIMException::FAILED, "Provider does not support createInstance");
	}

	////////////////////////////////////////////////////////////////////////////
	virtual void modifyInstance(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const CIMInstance& modifiedInstance,
		const CIMInstance& previousInstance,
		EIncludeQualifiersFlag includeQualifiers,
		const StringArray* propertyList,
		const CIMClass& theClass)
	{
		OW_THROWCIMMSG(CIMException::FAILED, "Provider does not support modifyInstance");
	}

	////////////////////////////////////////////////////////////////////////////
	virtual void deleteInstance(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const CIMObjectPath& cop)
	{
		OW_THROWCIMMSG(CIMException::FAILED, "Provider does not support deleteInstance");
	}

	////////////////////////////////////////////////////////////////////////////
	virtual CIMValue invokeMethod(
		const ProviderEnvironmentIFCRef& env,
		const String& ns,
		const CIMObjectPath& path,
		const String& methodName,
		const CIMParamValueArray& in,
		CIMParamValueArray& out )
	{
		if (methodName.equalsIgnoreCase("sendsignal"))
		{
			Int32 sig;
			in[0].getValue().get(sig);
			CIMPropertyArray keys = path.getKeys();
			pid_t pid = 0;
			for (CIMPropertyArray::const_iterator iter = keys.begin();
				iter != keys.end(); iter++)
			{
				if (iter->getName().equalsIgnoreCase("handle"))
				{
					String spid;
					iter->getValue().get(spid);
					pid = static_cast<pid_t>(spid.toInt32());
					break;
				}
			}

			if (pid != 0)
			{
				std::cerr << "Calling kill with pid " << pid << " and sig " << sig << std::endl;
				if (kill(pid, sig) == 0)
				{
					return CIMValue(String("Success"));
				}
				else
				{
					return CIMValue(String("Fail"));
				}
			}

		}
		else
		{
			OW_THROWCIMMSG(CIMException::FAILED, Format("Provider does not support "
				"method: %1", methodName).c_str());
		}
		return CIMValue(String("Fail"));
	}

	virtual int mustPoll(const ProviderEnvironmentIFCRef&,
			const WQLSelectStatement&, const String&, const String&,
			const StringArray&)
	{
		return 1; // The poll interval in seconds.  0 means no polling.  1 is very resource intensive, so is only appropriate for this sample.
	}

	virtual void getIndicationProviderInfo(IndicationProviderInfo& info)
	{
		// Add the class(es) we are monitoring for lifecycle indications. We only need to add the most derived classes to this array.
		const char* theMonitoredClasses[] =
			{
				"LinuxProcess",
				0
			};

		// all the life-cycle indications that may be generated by this provider. We have to add all the base classes to this array.
		const char* instanceLifeCycleIndicationClassNames[] =
			{
				"CIM_InstCreation",
				"CIM_InstModification",
				"CIM_InstDeletion",
				"CIM_InstIndication",
				"CIM_Indication",
				0
			};

		for (const char** pIndicationClassName = instanceLifeCycleIndicationClassNames;
			  *pIndicationClassName != 0;
			  ++pIndicationClassName)
		{
			const char* indicationClassName = *pIndicationClassName;
			IndicationProviderInfoEntry e(indicationClassName);
			for (const char** pClassName = theMonitoredClasses;
				  *pClassName != 0;
				  ++pClassName)
			{
				const char* className = *pClassName;
				e.classes.push_back(className);
			}
			info.addInstrumentedClass(e);

		}
	}

	// This doesn't need to do anything, it's just here to keep the compiler from spitting out warnings.
	virtual void getInstanceProviderInfo(InstanceProviderInfo&)
	{
	}

	// This doesn't need to do anything, it's just here to keep the compiler from spitting out warnings.
	virtual void getMethodProviderInfo(MethodProviderInfo&)
	{
	}

};

}

OW_PROVIDERFACTORY(LinuxProcess, linuxprocess)


text:
@interface AddReservationViewController : UIViewController

@property (strong,nonatomic) Room *selectedRoom;

@end


text:
package org.apache.carbondata.spark.testsuite.createTable.TestCreateDDLForComplexMapType

import java.io.{BufferedWriter, File, FileWriter}
import java.util

import au.com.bytecode.opencsv.CSVWriter
import org.apache.hadoop.conf.Configuration
import org.apache.spark.sql.{AnalysisException, Row}
import org.apache.spark.sql.test.util.QueryTest
import org.scalatest.BeforeAndAfterAll

import org.apache.carbondata.core.datastore.chunk.impl.DimensionRawColumnChunk
import scala.collection.JavaConversions._

class TestCreateDDLForComplexMapType extends QueryTest with BeforeAndAfterAll {
  private val conf: Configuration = new Configuration(false)

  val rootPath = new File(this.getClass.getResource("/").getPath
                          + "../../../..").getCanonicalPath

  val path = s"$rootPath/integration/spark-common-test/src/test/resources/maptest2.csv"

  private def checkForLocalDictionary(dimensionRawColumnChunks: util
  .List[DimensionRawColumnChunk]): Boolean = {
    var isLocalDictionaryGenerated = false
    import scala.collection.JavaConversions._
    isLocalDictionaryGenerated = dimensionRawColumnChunks
      .filter(dimensionRawColumnChunk => dimensionRawColumnChunk.getDataChunkV3
        .isSetLocal_dictionary).size > 0
    isLocalDictionaryGenerated
  }

  def createCSVFile(): Unit = {
    val out = new BufferedWriter(new FileWriter(path));
    val writer = new CSVWriter(out);

    val employee1 = Array("1\u0002Nalla\u00012\u0002Singh\u00011\u0002Gupta\u00014\u0002Kumar")

    val employee2 = Array("10\u0002Nallaa\u000120\u0002Sissngh\u0001100\u0002Gusspta\u000140" +
                          "\u0002Kumar")

    var listOfRecords = List(employee1, employee2)

    writer.writeAll(listOfRecords)
    out.close()
  }

  override def beforeAll(): Unit = {
    createCSVFile()
    sql("DROP TABLE IF EXISTS carbon")
  }

  override def afterAll(): Unit = {
    new File(path).delete()
  }

  test("Single Map One Level") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim.equals("map<string,string>"))
  }

  test("Single Map with Two Nested Level") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,map<INT,STRING>>
         | )
         | STORED BY
         |'carbondata'
         |"""
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim.equals("map<string,map<int,string>>"))
  }

  test("Map Type with array type as value") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,array<INT>>
         | )
         | STORED BY 'carbondata'
         |
         """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim.equals("map<string,array<int>>"))
  }

  test("Map Type with struct type as value") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,struct<key:INT,val:INT>>
         | )
         | STORED BY
         | 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim
      .equals("map<string,struct<key:int,val:int>>"))
  }

  test("Map Type as child to struct type") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField struct<key:INT,val:map<INT,INT>>
         | )
         | STORED BY
         |'carbondata' """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim
      .equals("struct<key:int,val:map<int,int>>"))
  }

  test("Map Type as child to array type") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField array<map<INT,INT>>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon """.stripMargin).collect()
    assert(desc(0).get(1).asInstanceOf[String].trim.equals("array<map<int,int>>"))
    sql("insert into carbon values('1\0032\0022\0033\001100\003200\002200\003300')")
    sql("select * from carbon").show(false)
  }

  test("Test Load data in map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    sql("insert into carbon values('1\002Nalla\0012\002Singh\0013\002Gupta\0014\002Kumar')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 3 -> "Gupta", 4 -> "Kumar"))))
  }

  test("Test Load data in map with empty value") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    sql("insert into carbon values('1\002Nalla\0012\002\0013\002Gupta\0014\002Kumar')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "", 3 -> "Gupta", 4 -> "Kumar"))))
  }

  // Global Dictionary for Map type
  test("Test Load data in map with dictionary include") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,STRING>
         | )
         | STORED BY 'carbondata'
         | TBLPROPERTIES('DICTIONARY_INCLUDE'='mapField')
         | """
        .stripMargin)
    sql("insert into carbon values('vi\002Nalla\001sh\002Singh\001al\002Gupta')")
    sql("select * from carbon").show(false)
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map("vi" -> "Nalla", "sh" -> "Singh", "al" -> "Gupta"))))
  }

  test("Test Load data in map with partition columns") {
    sql("DROP TABLE IF EXISTS carbon")
    val exception = intercept[AnalysisException](
      sql(
        s"""
           | CREATE TABLE carbon(
           | a INT,
           | mapField array<STRING>,
           | b STRING
           | )
           | PARTITIONED BY (mp map<int,string>)
           | STORED BY 'carbondata'
           | """
          .stripMargin)
    )
    assertResult("Cannot use map<int,string> for partition column;")(exception.getMessage())
  }

  test("Test IUD in map columns") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | a INT,
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql("insert into carbon values(1,'1\002Nalla\0012\002Singh\0013\002Gupta\0014\002Kumar')")
    sql("insert into carbon values(2,'1\002abc\0012\002xyz\0013\002hello\0014\002mno')")
    val exception = intercept[UnsupportedOperationException](
      sql("update carbon set(mapField)=('1,haha') where a=1").show(false))
    assertResult("Unsupported operation on Complex data type")(exception.getMessage())
    sql("delete from carbon where mapField[1]='abc'")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(1, Map(1 -> "Nalla", 2 -> "Singh", 3 -> "Gupta", 4 -> "Kumar"))))

  }

  test("Test Load duplicate keys data in map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    val desc = sql(
      s"""
         | Describe Formatted
         | carbon
         | """.stripMargin).collect()
    sql("insert into carbon values('1\002Nalla\0012\002Singh\0011\002Gupta\0014\002Kumar')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar"))))
  }

  test("Test Load data in map of map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,map<INT,STRING>>
         | )
         | STORED BY
         |'carbondata' """
        .stripMargin)
    sql(
      "insert into carbon values('manish\0021\004nalla\0032\004gupta\001kunal\0021\004kapoor\0032" +
      "\004sharma')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map("manish" -> Map(1 -> "nalla", 2 -> "gupta"),
        "kunal" -> Map(1 -> "kapoor", 2 -> "sharma")))))
  }

  test("Test Load duplicate keys data in map of map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<STRING,map<INT,STRING>>
         | )
         | STORED BY
         |'carbondata'
         |"""
        .stripMargin)
    sql(
      "insert into carbon values('manish\0021\004nalla\0031\004gupta\001kunal\0021\004kapoor\0032" +
      "\004sharma')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map("manish" -> Map(1 -> "nalla"),
        "kunal" -> Map(1 -> "kapoor", 2 -> "sharma")))))
  }

  test("Test Create table as select with map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql("DROP TABLE IF EXISTS carbon1")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql("insert into carbon values('1\002Nalla\0012\002Singh\0013\002Gupta\0014\002Kumar')")
    sql(
      s"""
         | CREATE TABLE carbon1
         | AS
         | Select *
         | From carbon
         | """
        .stripMargin)
    checkAnswer(sql("select * from carbon1"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 3 -> "Gupta", 4 -> "Kumar"))))
  }

  test("Test Create table with double datatype in map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<DOUBLE,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql(
      "insert into carbon values('1.23\002Nalla\0012.34\002Singh\0013.67676\002Gupta\0013.67676" +
      "\002Kumar')")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1.23 -> "Nalla", 2.34 -> "Singh", 3.67676 -> "Gupta"))))
  }

  test("Load Map data from CSV File") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar"))
    ))
  }

  test("test compaction with map data type") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    sql("alter table carbon compact 'minor'")
    sql("show segments for table carbon").show(false)
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar")),
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar")),
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar")),
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar"))
    ))
    sql("DROP TABLE IF EXISTS carbon")
  }

  test("Sort Column table property blocking for Map type") {
    sql("DROP TABLE IF EXISTS carbon")
    val exception1 = intercept[Exception] {
      sql(
        s"""
           | CREATE TABLE carbon(
           | mapField map<STRING,STRING>
           | )
           | STORED BY 'carbondata'
           | TBLPROPERTIES('SORT_COLUMNS'='mapField')
           | """
          .stripMargin)
    }
    assert(exception1.getMessage
      .contains(
        "sort_columns is unsupported for map datatype column: mapfield"))
  }

  test("Data Load Fail Issue") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,STRING>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql(
      s"""
         | LOAD DATA LOCAL INPATH '$path'
         | INTO TABLE carbon OPTIONS(
         | 'header' = 'false')
       """.stripMargin)
    sql("INSERT INTO carbon SELECT * FROM carbon")
    checkAnswer(sql("select * from carbon"), Seq(
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(1 -> "Nalla", 2 -> "Singh", 4 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar")),
      Row(Map(10 -> "Nallaa", 20 -> "Sissngh", 100 -> "Gusspta", 40 -> "Kumar"))
      ))
  }

  test("Struct inside map") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,struct<kk:STRING,mm:STRING>>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql("INSERT INTO carbon values('1\002man\003nan\0012\002kands\003dsnknd')")
    sql("INSERT INTO carbon SELECT * FROM carbon")
    checkAnswer(sql("SELECT * FROM carbon limit 1"),
      Seq(Row(Map(1 -> Row("man", "nan"), (2 -> Row("kands", "dsnknd"))))))
  }

  test("Struct inside map pushdown") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | mapField map<INT,struct<kk:STRING,mm:STRING>>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql("INSERT INTO carbon values('1\002man\003nan\0012\002kands\003dsnknd')")
    checkAnswer(sql("SELECT mapField[1].kk FROM carbon"), Row("man"))
  }

  test("Map inside struct") {
    sql("DROP TABLE IF EXISTS carbon")
    sql(
      s"""
         | CREATE TABLE carbon(
         | structField struct<intVal:INT,map1:MAP<STRING,STRING>>
         | )
         | STORED BY 'carbondata'
         | """
        .stripMargin)
    sql("INSERT INTO carbon values('1\001man\003nan\002kands\003dsnknd')")
    val res = sql("SELECT structField.intVal FROM carbon").show(false)
    checkAnswer(sql("SELECT structField.intVal FROM carbon"), Seq(Row(1)))
  }

}


text:
package com.sun.media.sound;

import java.io.DataInputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;

import javax.sound.sampled.AudioFileFormat;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;

/**
 * WAVE file reader.
 *
 * @author Kara Kytle
 * @author Jan Borgersen
 * @author Florian Bomers
 */
public final class WaveFileReader extends SunFileReader {

    private static final int MAX_READ_LENGTH = 12;

    /**
     * Obtains the audio file format of the input stream provided.  The stream must
     * point to valid audio file data.  In general, audio file providers may
     * need to read some data from the stream before determining whether they
     * support it.  These parsers must
     * be able to mark the stream, read enough data to determine whether they
     * support the stream, and, if not, reset the stream's read pointer to its original
     * position.  If the input stream does not support this, this method may fail
     * with an IOException.
     * @param stream the input stream from which file format information should be
     * extracted
     * @return an AudioFileFormat object describing the audio file format
     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     * @see InputStream#markSupported
     * @see InputStream#mark
     */
    public AudioFileFormat getAudioFileFormat(InputStream stream) throws UnsupportedAudioFileException, IOException {
        // fix for 4489272: AudioSystem.getAudioFileFormat() fails for InputStream, but works for URL
        AudioFileFormat aff = getFMT(stream, true);
        // the following is not strictly necessary - but was implemented like that in 1.3.0 - 1.4.1
        // so I leave it as it was. May remove this for 1.5.0
        stream.reset();
        return aff;
    }

    /**
     * Obtains the audio file format of the URL provided.  The URL must
     * point to valid audio file data.
     * @param url the URL from which file format information should be
     * extracted
     * @return an AudioFileFormat object describing the audio file format
     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     */
    public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException {
        InputStream urlStream = url.openStream(); // throws IOException
        AudioFileFormat fileFormat = null;
        try {
            fileFormat = getFMT(urlStream, false);
        } finally {
            urlStream.close();
        }
        return fileFormat;
    }

    /**
     * Obtains the audio file format of the File provided.  The File must
     * point to valid audio file data.
     * @param file the File from which file format information should be
     * extracted
     * @return an AudioFileFormat object describing the audio file format
     * @throws UnsupportedAudioFileException if the File does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     */
    public AudioFileFormat getAudioFileFormat(File file) throws UnsupportedAudioFileException, IOException {
        AudioFileFormat fileFormat = null;
        FileInputStream fis = new FileInputStream(file);       // throws IOException
        // part of fix for 4325421
        try {
            fileFormat = getFMT(fis, false);
        } finally {
            fis.close();
        }

        return fileFormat;
    }

    /**
     * Obtains an audio stream from the input stream provided.  The stream must
     * point to valid audio file data.  In general, audio file providers may
     * need to read some data from the stream before determining whether they
     * support it.  These parsers must
     * be able to mark the stream, read enough data to determine whether they
     * support the stream, and, if not, reset the stream's read pointer to its original
     * position.  If the input stream does not support this, this method may fail
     * with an IOException.
     * @param stream the input stream from which the AudioInputStream should be
     * constructed
     * @return an AudioInputStream object based on the audio file data contained
     * in the input stream.
     * @throws UnsupportedAudioFileException if the stream does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     * @see InputStream#markSupported
     * @see InputStream#mark
     */
    public AudioInputStream getAudioInputStream(InputStream stream) throws UnsupportedAudioFileException, IOException {
        // getFMT leaves the input stream at the beginning of the audio data
        AudioFileFormat fileFormat = getFMT(stream, true); // throws UnsupportedAudioFileException, IOException

        // we've got everything, and the stream is at the
        // beginning of the audio data, so return an AudioInputStream.
        return new AudioInputStream(stream, fileFormat.getFormat(), fileFormat.getFrameLength());
    }

    /**
     * Obtains an audio stream from the URL provided.  The URL must
     * point to valid audio file data.
     * @param url the URL for which the AudioInputStream should be
     * constructed
     * @return an AudioInputStream object based on the audio file data pointed
     * to by the URL
     * @throws UnsupportedAudioFileException if the URL does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     */
    public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
        InputStream urlStream = url.openStream();  // throws IOException
        AudioFileFormat fileFormat = null;
        try {
            fileFormat = getFMT(urlStream, false);
        } finally {
            if (fileFormat == null) {
                urlStream.close();
            }
        }
        return new AudioInputStream(urlStream, fileFormat.getFormat(), fileFormat.getFrameLength());
    }

    /**
     * Obtains an audio stream from the File provided.  The File must
     * point to valid audio file data.
     * @param file the File for which the AudioInputStream should be
     * constructed
     * @return an AudioInputStream object based on the audio file data pointed
     * to by the File
     * @throws UnsupportedAudioFileException if the File does not point to valid audio
     * file data recognized by the system
     * @throws IOException if an I/O exception occurs
     */
    public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException {
        FileInputStream fis = new FileInputStream(file); // throws IOException
        AudioFileFormat fileFormat = null;
        // part of fix for 4325421
        try {
            fileFormat = getFMT(fis, false);
        } finally {
            if (fileFormat == null) {
                fis.close();
            }
        }
        return new AudioInputStream(fis, fileFormat.getFormat(), fileFormat.getFrameLength());
    }

    //--------------------------------------------------------------------

    private AudioFileFormat getFMT(InputStream stream, boolean doReset) throws UnsupportedAudioFileException, IOException {

        // assumes sream is rewound

        int bytesRead;
        int nread = 0;
        int fmt;
        int length = 0;
        int wav_type = 0;
        short channels;
        long sampleRate;
        long avgBytesPerSec;
        short blockAlign;
        int sampleSizeInBits;
        AudioFormat.Encoding encoding = null;

        DataInputStream dis = new DataInputStream( stream );

        if (doReset) {
            dis.mark(MAX_READ_LENGTH);
        }

        int magic = dis.readInt();
        int fileLength = rllong(dis);
        int waveMagic = dis.readInt();
        int totallength;
        if (fileLength <= 0) {
            fileLength = AudioSystem.NOT_SPECIFIED;
            totallength = AudioSystem.NOT_SPECIFIED;
        } else {
            totallength = fileLength + 8;
        }

        if ((magic != WaveFileFormat.RIFF_MAGIC) || (waveMagic != WaveFileFormat.WAVE_MAGIC)) {
            // not WAVE, throw UnsupportedAudioFileException
            if (doReset) {
                dis.reset();
            }
            throw new UnsupportedAudioFileException("not a WAVE file");
        }

        // find and read the "fmt" chunk
        // we break out of this loop either by hitting EOF or finding "fmt "
        while(true) {

            try {
                fmt = dis.readInt();
                nread += 4;
                if( fmt==WaveFileFormat.FMT_MAGIC ) {
                    // we've found the 'fmt' chunk
                    break;
                } else {
                    // else not 'fmt', skip this chunk
                    length = rllong(dis);
                    nread += 4;
                    if (length % 2 > 0) length++;
                    nread += dis.skipBytes(length);
                }
            } catch (EOFException eof) {
                                // we've reached the end of the file without finding the 'fmt' chunk
                throw new UnsupportedAudioFileException("Not a valid WAV file");
            }
        }

        // Read the format chunk size.
        length = rllong(dis);
        nread += 4;

        // This is the nread position at the end of the format chunk
        int endLength = nread + length;

        // Read the wave format data out of the format chunk.

        // encoding.
        wav_type = rlshort(dis); nread += 2;

        if (wav_type == WaveFileFormat.WAVE_FORMAT_PCM)
            encoding = AudioFormat.Encoding.PCM_SIGNED;  // if 8-bit, we need PCM_UNSIGNED, below...
        else if ( wav_type == WaveFileFormat.WAVE_FORMAT_ALAW )
            encoding = AudioFormat.Encoding.ALAW;
        else if ( wav_type == WaveFileFormat.WAVE_FORMAT_MULAW )
            encoding = AudioFormat.Encoding.ULAW;
        else {
            // we don't support any other WAVE formats....
            throw new UnsupportedAudioFileException("Not a supported WAV file");
        }
        // channels
        channels = rlshort(dis); nread += 2;
        if (channels <= 0) {
            throw new UnsupportedAudioFileException("Invalid number of channels");
        }

        // sample rate.
        sampleRate = rllong(dis); nread += 4;

        // this is the avgBytesPerSec
        avgBytesPerSec = rllong(dis); nread += 4;

        // this is blockAlign value
        blockAlign = rlshort(dis); nread += 2;

        // this is the PCM-specific value bitsPerSample
        sampleSizeInBits = (int)rlshort(dis); nread += 2;
        if (sampleSizeInBits <= 0) {
            throw new UnsupportedAudioFileException("Invalid bitsPerSample");
        }

        // if sampleSizeInBits==8, we need to use PCM_UNSIGNED
        if ((sampleSizeInBits==8) && encoding.equals(AudioFormat.Encoding.PCM_SIGNED))
            encoding = AudioFormat.Encoding.PCM_UNSIGNED;

        // skip any difference between the length of the format chunk
        // and what we read

        // if the length of the chunk is odd, there's an extra pad byte
        // at the end.  i've never seen this in the fmt chunk, but we
        // should check to make sure.

        if (length % 2 != 0) length += 1;

        // $$jb: 07.28.99: endLength>nread, not length>nread.
        //       This fixes #4257986
        if (endLength > nread)
            nread += dis.skipBytes(endLength - nread);

        // we have a format now, so find the "data" chunk
        // we break out of this loop either by hitting EOF or finding "data"
        // $$kk: if "data" chunk precedes "fmt" chunk we are hosed -- can this legally happen?
        nread = 0;
        while(true) {
            try{
                int datahdr = dis.readInt();
                nread+=4;
                if (datahdr == WaveFileFormat.DATA_MAGIC) {
                    // we've found the 'data' chunk
                    break;
                } else {
                    // else not 'data', skip this chunk
                    int thisLength = rllong(dis); nread += 4;
                    if (thisLength % 2 > 0) thisLength++;
                    nread += dis.skipBytes(thisLength);
                }
            } catch (EOFException eof) {
                // we've reached the end of the file without finding the 'data' chunk
                throw new UnsupportedAudioFileException("Not a valid WAV file");
            }
        }
        // this is the length of the data chunk
        int dataLength = rllong(dis); nread += 4;

        // now build the new AudioFileFormat and return

        AudioFormat format = new AudioFormat(encoding,
                                             (float)sampleRate,
                                             sampleSizeInBits, channels,
                                             calculatePCMFrameSize(sampleSizeInBits, channels),
                                             (float)sampleRate, false);

        return new WaveFileFormat(AudioFileFormat.Type.WAVE,
                                  totallength,
                                  format,
                                  dataLength / format.getFrameSize());
    }
}


text:
require 'spec_helper'

# it should have been deleted
describe command('aws s3 ls s3://ec2-start-kitchen-bucketname-todelete') do
  its(:stderr) { should contain(/The specified bucket does not exist/) }
end


text:
$(function(){
  $('#about_link').click(about_section);
  $('#projects_link').click(projects_section);
  $('#contact_link').click(contact_section);
});

function about_section(){
  $('#projects_section').hide();
  $('#contact_section').hide();
  $('#about_section').show();
}

function projects_section(){
  var slider = $('#slider');
  $('#about_section').hide();
  $('#contact_section').hide();
  $('#projects_section').show();
  slider.addClass('bxSlider');
  if ($('.bx-wrapper').length <= 0) {
    $('.bxslider').bxSlider({
    mode: 'fade',
    captions: true
});
}

}

function contact_section(){
  $('#projects_section').hide();
  $('#about_section').hide();
  $('#contact_section').show();
}


text:
cask 'apache-couchdb' do
  version '3.1.0'
  sha256 'a6309b41c60db137877f67ebb4b4d1674cdba3c0abac247c6dff89cd591ca116'

  # couchdbneighbourhoodie.fra1.digitaloceanspaces.com/ was verified as official when first introduced to the cask
  url "https://couchdbneighbourhoodie.fra1.digitaloceanspaces.com/downloads/#{version}/mac/Apache-CouchDB.zip"
  appcast 'https://docs.couchdb.org/en/stable/whatsnew/index.html'
  name 'Apache CouchDB'
  homepage 'https://couchdb.apache.org/'

  app 'Apache CouchDB.app'

  zap trash: [
               '~/Library/Application Support/CouchDB',
               '~/Library/Caches/org.apache.couchdb',
               '~/Library/Logs/couchdb.log',
               '~/Library/Logs/couchdb.log.old',
               '~/Library/Preferences/org.apache.couchdb.plist',
             ]
end


text:
package org.apache.sftp.fs;

import java.nio.file.attribute.UserPrincipal;

public class UidUserPrincipal implements UserPrincipal {
    private int uid;

    public UidUserPrincipal( int uid ) {
        this.uid = uid;
    }

    @Override
    public String getName() {
        // its unsigned in sftp so...
        return Long.toString( uid );
    }

}


text:
function m = RenameModel(m, name)

m.Name = fixModelName(name);


text:
package com.gs.fw.common.mithra.util;

public class ColumnInfo implements Comparable
{

    private final String name;
    private final int type;
    private final int size;
    private final int precision;
    private final int scale;
    private final int ordinalPosition;
    private final boolean nullable;

    public ColumnInfo(String name, int type, int size, int precision, int scale, int ordinalPosition, boolean nullable)
    {
        this.name = name;
        this.type = type;
        this.size = size;
        this.precision = precision;
        this.scale = scale;
        this.ordinalPosition = ordinalPosition;
        this.nullable = nullable;
    }

    public String getName()
    {
        return this.name;
    }

    public int getType()
    {
        return this.type;
    }

    public int getSize()
    {
        return this.size;
    }

    public int getPrecision()
    {
        return this.precision;
    }

    public int getScale()
    {
        return this.scale;
    }

    public int getOrdinalPosition()
    {
        return this.ordinalPosition;
    }

    public boolean isNullable()
    {
        return this.nullable;
    }

    public int compareTo(Object o)
    {
        ColumnInfo other = (ColumnInfo) o;
        return this.ordinalPosition - other.ordinalPosition;
    }
}


text:
package com.example.android.leanback;
import android.app.Activity;
import android.os.Bundle;

/**
 * Main Activity for the Music Player
 */
public class MusicExampleActivity extends Activity {

    @Override public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_music_example);
    }
}


text:
package uk.co.plogic.gwt.lib.map.overlay;

import java.util.logging.Logger;

import uk.co.plogic.gwt.lib.comms.DropBox;
import uk.co.plogic.gwt.lib.comms.UxPostalService.LetterBox;
import uk.co.plogic.gwt.lib.comms.envelope.Envelope;
import uk.co.plogic.gwt.lib.dom.DomElementByClassNameFinder;
import uk.co.plogic.gwt.lib.dom.DomParser;
import uk.co.plogic.gwt.lib.events.MapMarkerClickEvent;
import uk.co.plogic.gwt.lib.events.MapMarkerClickEventHandler;
import uk.co.plogic.gwt.lib.map.GoogleMapAdapter;
import uk.co.plogic.gwt.lib.map.markers.IconMarker;
import uk.co.plogic.gwt.lib.utils.AttributeDictionary;
import uk.co.plogic.gwt.lib.utils.StringUtils;

import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.maps.gwt.client.InfoWindow;
import com.google.maps.gwt.client.InfoWindowOptions;
import com.google.maps.gwt.client.GoogleMap.BoundsChangedHandler;
import com.google.maps.gwt.client.GoogleMap.CenterChangedHandler;

public abstract class AbstractClusteredOverlay extends AbstractOverlay implements DropBox {

    protected Logger logger = Logger.getLogger("AbstractClusteredOverlay");
	protected LetterBox letterBoxClusterFeatures;
	protected uk.co.plogic.gwt.lib.comms.GeneralJsonService.LetterBox letterBoxNodeInfo;
	protected String nodeInfoPathTemplate;

	protected InfoWindow infowindow;
    protected InfoWindowOptions infowindowOpts;
    protected IconMarker markerWithInfoWindow;

    protected int requestedNoPoints = 45;
    protected final static int markerAnimationDuration = 750;
	protected String namespace = "";

	protected final static int delayDuration = 200; // wait a bit after map moves and eventBus requests
	protected Timer requestTimer;  		  			// before making a request to the cluster server

	public AbstractClusteredOverlay(HandlerManager eventBus) {
		super(eventBus);
		requestTimer = new Timer() {
		    @Override
		    public void run() {
		    	logger.fine("requesting now");

		    	if( gMap != null && isVisible() ) {
			    	letterBoxClusterFeatures.send(factoryRequestEnvelope());
		    	}
		    }
		};
	}

	/**
	 * create a new envelope containing bounding box etc. ready for new server request
	 * @return
	 */
	abstract Envelope factoryRequestEnvelope();

	@Override
	public void setMap(GoogleMapAdapter mapAdapter) {

		super.setMap(mapAdapter);
		setupInfoWindow();

//		gMap.addIdleListener(new IdleHandler(){
//
//			@Override
//			public void handle() {
//				System.out.println("Idle now");
//
//			}
//
//		});
//		gMap.addZoomChangedListener(new ZoomChangedHandler() {
//
//			@Override
//			public void handle() {
//				System.out.println("zoom changed");
//			}
//
//		});
		gMap.addBoundsChangedListener(new BoundsChangedHandler() {

			@Override
			public void handle() {
				//System.out.println("bounds changed");
				requestTimer.cancel();
				requestTimer.schedule(delayDuration);
			}

		});

		gMap.addCenterChangedListener(new CenterChangedHandler() {

			@Override
			public void handle() {
				//System.out.println("center changed");
				requestTimer.cancel();
				requestTimer.schedule(delayDuration);
			}

		});

//		gMap.addDragEndListener(new DragEndHandler() {
//
//			@Override
//			public void handle() {
//				System.out.println("end drag");
//			}
//
//		});
//
//		gMap.addResizeListener(new ResizeHandler() {
//
//			@Override
//			public void handle() {
//				System.out.println("resized");
//			}
//
//		});
	}

	public int getRequestedNoPoints() {
		return requestedNoPoints;
	}

	public void setRequestedNoPoints(int requestedNoPoints) {
		this.requestedNoPoints = requestedNoPoints;
	}

	public void setLetterBoxClusterPoints(String datasetName, LetterBox registeredLetterBox) {
		letterBoxClusterFeatures = registeredLetterBox;
		namespace = datasetName;
	}

	public void setLetterBoxNodeInfo(String nodeInfoPathTemplate,
    uk.co.plogic.gwt.lib.comms.GeneralJsonService.LetterBox registeredLetterBox) {
	    this.nodeInfoPathTemplate = nodeInfoPathTemplate;
		letterBoxNodeInfo = registeredLetterBox;
	}

	protected void setupInfoWindow() {

	    infowindowOpts = InfoWindowOptions.create();
	    infowindowOpts.setMaxWidth(500);
	    infowindow = InfoWindow.create(infowindowOpts);

        eventBus.addHandler(MapMarkerClickEvent.TYPE, new MapMarkerClickEventHandler() {

			@Override
			public void onClick(MapMarkerClickEvent e) {

			    if( nodeInfoPathTemplate == null )
			        return;

		    	markerWithInfoWindow = (IconMarker) e.getMapPointMarker();
		    	// namespace:id
		    	String[] idParts = markerWithInfoWindow.getId().split(":");
		    	if( ! idParts[0].equals(namespace) ) {
		    		// doesn't belong to this ClusterPoints
		    	    markerWithInfoWindow = null;
		    		return;
		    	}
		    	updateInfoWindow(null);
	    		infowindow.setPosition(markerWithInfoWindow.getMapMarker().getPosition());
	    		infowindow.open(gMap);
			}
        });
	}

	/**
	 *
	 * @param url
	 * @param optionalArgs - already urlencoded
	 */
	private void updateInfoWindow(String optionalArgs) {

	    String[] idParts = markerWithInfoWindow.getId().split(":");
	    AttributeDictionary nodeData = new AttributeDictionary();
        nodeData.set("node_id", idParts[1]);
        String nodeInfoPath = StringUtils.renderHtml(nodeInfoPathTemplate, nodeData);
        if( optionalArgs != "" && optionalArgs != null ) {
            nodeInfoPath += optionalArgs;
        }

        letterBoxNodeInfo.setUrl(nodeInfoPath);
        letterBoxNodeInfo.send();

         // clear existing. New copy set in onDelivery()
        infowindow.setContent("");
	}

   @Override
    public void onDeliveryProblem(String letterBoxName, int statusCode) {
        // do nothing
    }

	@Override
	public void onDelivery(String letterBoxName, String jsonEncodedPayload) {

		if( letterBoxName.equals(namespace) )
			processClusterFeaturesEnvelope(jsonEncodedPayload);
		else
			processNodeInfo(jsonEncodedPayload);
	}

	abstract void processClusterFeaturesEnvelope(String jsonEncodedPayload);

	protected void processNodeInfo(String jsonEncodedPayload) {

	    JSONValue j = JSONParser.parseLenient(jsonEncodedPayload);
	    String htmlContent = j.isString().stringValue();

	    // find the "info_window_update" class which marks anchor tags
	    // with a url to update the infowindow with.
	    DomParser domParser = new DomParser();
	    domParser.addHandler(new DomElementByClassNameFinder("info_window_update") {
            @Override
            public void onDomElementFound(final Element element, String id) {

                Event.setEventListener(element, new EventListener() {
                    @Override
                    public void onBrowserEvent(Event event) {
                        switch (DOM.eventGetType(event)) {
                        case Event.ONCLICK:
                            // contents of data-get-args must already be urlencoded
                            String getArg = "?"+element.getAttribute("data-get-args");

                            updateInfoWindow(getArg);
                            event.preventDefault();
                            break;
                        }
                    }
                });

                Event.sinkEvents(element, Event.ONCLICK);
            }
        });

		HTML infoWindowBody = new HTML(htmlContent);
	    infoWindowBody.setStyleName("info_window");
		FlowPanel info_panel = new FlowPanel();
    	info_panel.setStyleName("info_window");
    	info_panel.add(infoWindowBody);
        infowindow.setContent(info_panel.getElement());

        domParser.parseDom(infoWindowBody.getElement());
	}

	abstract public void refreshMapMarkers();

}


text:
namespace gpdxl
{
using namespace gpos;
using namespace gpmd;
using namespace gpnaucrates;

XERCES_CPP_NAMESPACE_USE

//---------------------------------------------------------------------------
//	@class:
//		CParseHandlerStatsDerivedRelation
//
//	@doc:
//		Base parse handler class for derived relation statistics
//
//---------------------------------------------------------------------------
class CParseHandlerStatsDerivedRelation : public CParseHandlerBase
{
private:
	// number of rows in the relation
	CDouble m_rows;

	// flag to express that the statistics is on an empty input
	BOOL m_empty;

	// relation stats
	CDXLStatsDerivedRelation *m_dxl_stats_derived_relation;

	// private copy ctor
	CParseHandlerStatsDerivedRelation(
		const CParseHandlerStatsDerivedRelation &);

	// process the start of an element
	void StartElement(
		const XMLCh *const element_uri,			// URI of element's namespace
		const XMLCh *const element_local_name,	// local part of element's name
		const XMLCh *const element_qname,		// element's qname
		const Attributes &attr					// element's attributes
	);

	// process the end of an element
	void EndElement(
		const XMLCh *const element_uri,			// URI of element's namespace
		const XMLCh *const element_local_name,	// local part of element's name
		const XMLCh *const element_qname		// element's qname
	);

public:
	// ctor
	CParseHandlerStatsDerivedRelation(CMemoryPool *mp,
									  CParseHandlerManager *parse_handler_mgr,
									  CParseHandlerBase *parse_handler_root);

	// dtor
	virtual ~CParseHandlerStatsDerivedRelation();

	// the derived relation stats
	CDXLStatsDerivedRelation *
	GetDxlStatsDrvdRelation() const
	{
		return m_dxl_stats_derived_relation;
	}
};
}  // namespace gpdxl

#endif	// !GPDXL_CParseHandlerStatsDerivedRelation_H

// EOF


text:
import os
import time

from pyftpdlib.filesystems import FilesystemError
from pyftpdlib._compat import PY3, u, unicode
_months_map = {1:'Jan', 2:'Feb', 3:'Mar', 4:'Apr', 5:'May', 6:'Jun', 7:'Jul',
               8:'Aug', 9:'Sep', 10:'Oct', 11:'Nov', 12:'Dec'}
from pyftpdlib.filesystems import AbstractedFS

import oss_fs_impl

class OssFS(AbstractedFS):

    def __init__(self, root, cmd_channel):
        assert isinstance(root, unicode), root
        AbstractedFS.__init__(self, root, cmd_channel)
        bucket_name = root.strip('/')
        if bucket_name.find('/') > -1:
            index = bucket_name.find('/')
            bucket_name = bucket_name[:index]
        bucket_info = cmd_channel.authorizer.get_bucket_info(bucket_name)
        access_key_id, access_key_secret= list(bucket_info.access_key.items())[0]
        endpoint = bucket_info.endpoint
        self.oss_fs_impl = oss_fs_impl.OssFsImpl(bucket_name, endpoint, access_key_id, access_key_secret)

    def open(self, filename, mode):
        assert isinstance(filename, unicode), filename
        if mode.startswith('r') or mode.startswith('R'):
            return self.oss_fs_impl.open_read(filename)
        else:
            return self.oss_fs_impl.open_write(filename)

    def chdir(self, path):
        assert isinstance(path, unicode), path
        if not self.isdir(path):
            raise FilesystemError('Not a dir.')
        path = path.replace('\\', '/')
        if not path.startswith(self.root):
            path = u'/'
        else:
            path = path[len(self.root):]
        if path == "":
            path = u'/'
        if not path.startswith('/'):
            path = '/' + path
        self._cwd = path

    def mkdir(self, path):
        assert isinstance(path, unicode), path
        self.oss_fs_impl.mkdir(path)

    def infopath(self, path):
        assert isinstance(path, unicode), path
        self.oss_fs_impl.infopath(path)

    def listdir(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.listdir(path)

    def rmdir(self, path):
        assert isinstance(path, unicode), path
        self.oss_fs_impl.rmdir(path)

    def remove(self, path):
        assert isinstance(path, unicode), path
        self.oss_fs_impl.remove(path)

    def lexists(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.lexists(path)
    '''
    def realpath(self, path):
        assert isinstance(path, unicode), path
        return path
    '''

    def rename(self, src, dst):
        assert isinstance(src, unicode), src
        assert isinstance(dst, unicode), dst
        self.oss_fs_impl.rename(src, dst)

    def chmod(self, path, mode):
        assert isinstance(path, unicode), path
        raise FilesystemError("method chmod is not implied")

    def getsize(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.getsize(path)

    def getmtime(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.getmtime(path)

    def stat(self, path):
        return ""

    def isfile(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.isfile(path)

    def isdir(self, path):
        assert isinstance(path, unicode), path
        return self.oss_fs_impl.isdir(path)

    def get_list_dir(self, path):
        assert isinstance(path, unicode), path
        if self.isdir(path):
            listing = self.listdir(path)
            try:
                listing.sort()
            except UnicodeDecodeError:
                pass
            return self.format_list(path, listing)
        else:
            basedir, filename = os.path.split(path)
            return self.format_list(basedir, [(filename, 0, 0)])

    def format_list(self, basedir, listing, ignore_err=True):
        assert isinstance(basedir, unicode), basedir
        if listing:
            assert isinstance(listing[0][0], unicode)
        if self.cmd_channel.use_gmt_times:
            timefunc = time.gmtime
        else:
            timefunc = time.localtime
        now = time.time()
        for (basename, size, modify) in listing:
            if basename == '':
                continue
            file = os.path.join(basedir, basename)
            isdir = file.endswith('/')
            if isdir:
                perms = 'drwxrwxrwx'
            else:
                perms = '-rw-rw-rw-'
            nlinks = 1
            uname = 'owner'
            gname = 'group'
            mtime = timefunc(now)
            mtimestr = "Aug 13 03:35"
            if not isdir:
                mtimestr = "%s %s" % (_months_map[int(modify[5:7])],
                                      "%s %s:%s" % (modify[2:4], modify[11:13], modify[14:16]))
            else:
                mtimestr = "%s %s" % (_months_map[mtime.tm_mon],
                                      time.strftime("%d %H:%M", mtime))
                size = 0

            line = "%s %3s %-8s %-8s %8s %s %s\r\n" % (perms, nlinks, uname, gname,
                                                       size, mtimestr, basename.rstrip('/'))
            yield line.encode('utf8', self.cmd_channel.unicode_errors)

    def format_mlsx(self, basedir, listing, perms, facts, ignore_err=True):
        assert isinstance(basedir, unicode), basedir
        if listing:
            assert isinstance(listing[0][0], unicode)
        if self.cmd_channel.use_gmt_times:
            timefunc = time.gmtime
        else:
            timefunc = time.localtime
        permdir = ''.join([x for x in perms if x not in 'arw'])
        permfile = ''.join([x for x in perms if x not in 'celmp'])
        if ('w' in perms) or ('a' in perms) or ('f' in perms):
            permdir += 'c'
        if 'd' in perms:
            permdir += 'p'
        show_type = 'type' in facts
        show_perm = 'perm' in facts
        show_size = 'size' in facts
        show_modify = 'modify' in facts
        show_create = 'create' in facts
        show_mode = 'unix.mode' in facts
        show_uid = 'unix.uid' in facts
        show_gid = 'unix.gid' in facts
        show_unique = 'unique' in facts
        for (basename, size, modify) in listing:
            if basename == '':
                continue
            retfacts = dict()
            file = os.path.join(basedir, basename)
            isdir = file.endswith('/')
            if isdir:
                if show_type:
                    if basename == '.':
                        retfacts['type'] = 'cdir'
                    elif basename == '..':
                        retfacts['type'] = 'pdir'
                    else:
                        retfacts['type'] = 'dir'
                if show_perm:
                    retfacts['perm'] = permdir
            else:
                if show_type:
                    retfacts['type'] = 'file'
                if show_perm:
                    retfacts['perm'] = permfile
            if show_size and not isdir:
                retfacts['size'] = size
            # last modification time
            if not isdir:
                retfacts['modify'] = modify[:4] + modify[5:7] + modify[8:10] + modify[11:13] + modify[14:16] + modify[17:19]
            factstring = "".join(["%s=%s;" % (x, retfacts[x]) \
                                  for x in sorted(retfacts.keys())])
            line = "%s %s\r\n" % (factstring, basename.rstrip('/'))
            yield line.encode('utf8', self.cmd_channel.unicode_errors)


text:
package io.iohk.ethereum.vm

import akka.util.ByteString
import io.iohk.ethereum.crypto.kec256

import scala.annotation.tailrec

/**
  * Holds a program's code and provides utilities for accessing it (defaulting to zeroes when out of scope)
  *
  * @param code the EVM bytecode as bytes
  */
case class Program(code: ByteString) {

  def getByte(pc: Int): Byte =
    code.lift(pc).getOrElse(0)

  def getBytes(from: Int, size: Int): ByteString =
    code.slice(from, from + size).padTo(size, 0.toByte)

  val length: Int = code.size

  lazy val validJumpDestinations: Set[Int] = validJumpDestinationsAfterPosition(0)

  /**
    * Returns the valid jump destinations of the program after a given position
    * See section 9.4.3 in Yellow Paper for more detail.
    *
    * @param pos from where to start searching for valid jump destinations in the code.
    * @param accum with the previously obtained valid jump destinations.
    */
  @tailrec
  private def validJumpDestinationsAfterPosition(pos: Int, accum: Set[Int] = Set.empty): Set[Int] = {
    if (pos < 0 || pos >= length) accum
    else {
      val byte = code(pos)
      val opCode = EvmConfig.FrontierOpCodes.byteToOpCode.get(
        byte
      ) // we only need to check PushOp and JUMPDEST, they are both present in Frontier
      opCode match {
        case Some(pushOp: PushOp) => validJumpDestinationsAfterPosition(pos + pushOp.i + 2, accum)
        case Some(JUMPDEST) => validJumpDestinationsAfterPosition(pos + 1, accum + pos)
        case _ => validJumpDestinationsAfterPosition(pos + 1, accum)
      }
    }
  }

  lazy val codeHash: ByteString =
    kec256(code)

}


text:
import Cookies from "cookies-js"
import React from "react"
import { data as sd } from "sharify"

import { handleSubmit, setCookies } from "../helpers"
import { ModalManager } from "reaction/Components/Authentication/Desktop/ModalManager"
import {
  ModalOptions,
  ModalType,
} from "reaction/Components/Authentication/Types"

const mediator = require("../../../lib/mediator.coffee")

export const ModalContainer: React.SFC<any> = () => {
  let manager: ModalManager | null

  mediator.on("open:auth", (options: ModalOptions) => {
    options.destination = options.destination || location.href

    setCookies(options)

    if (options && (options.mode as any) === "register") {
      options.mode = ModalType.signup
    }

    setTimeout(() => {
      if (manager) {
        manager.openModal(options)
      }
    }, document.readyState === "complete" ? 0 : 500)
  })

  mediator.on("auth:error", err => {
    if (manager) {
      manager.setError(err)
    }
  })

  return (
    <ModalManager
      ref={ref => (manager = ref)}
      submitUrls={{
        login: sd.AP.loginPagePath,
        signup: sd.AP.signupPagePath,
        facebook: sd.AP.facebookPath,
        twitter: sd.AP.twitterPath,
      }}
      csrf={sd.CSRF_TOKEN}
      handleSubmit={handleSubmit as any}
      onSocialAuthEvent={data => {
        const analyticsOptions = {
          action:
            data.mode === "signup"
              ? "Created account"
              : "Successfully logged in",
          type: data.mode,
          context_module: data.contextModule,
          modal_copy: data.copy,
          trigger: data.trigger || "click",
          trigger_seconds: data.triggerSeconds,
          intent: data.intent,
          auth_redirect: data.redirectTo || data.destination,
          service: data.service,
        }

        Cookies.set(
          `analytics-${data.mode}`,
          JSON.stringify(analyticsOptions),
          {
            expires: 60 * 60 * 24,
          }
        )
      }}
      onModalClose={() => {
        mediator.trigger("modal:closed")
      }}
    />
  )
}


text:
SUBDIR+=netstat
SUBDIR+=altqstat mcastsend mcastread mchat v6test

.include <bsd.subdir.mk>


text:
import {
    TextCommonOption, LineStyleOption, OrdinalRawValue, ZRColor,
    AreaStyleOption, ComponentOption, ColorString,
    AnimationOptionMixin, Dictionary, ScaleDataValue, CommonAxisPointerOption
} from '../util/types';

export const AXIS_TYPES = {value: 1, category: 1, time: 1, log: 1} as const;
export type OptionAxisType = keyof typeof AXIS_TYPES;

export interface AxisBaseOptionCommon extends ComponentOption,
    AnimationOptionMixin {
    type?: OptionAxisType;
    show?: boolean;
    // Inverse the axis.
    inverse?: boolean;
    // Axis name displayed.
    name?: string;
    nameLocation?: 'start' | 'middle' | 'end';
    // By degree.
    nameRotate?: number;
    nameTruncate?: {
        maxWidth?: number;
        ellipsis?: string;
        placeholder?: string;
    };
    nameTextStyle?: AxisNameTextStyleOption;
    // The gap between axisName and axisLine.
    nameGap?: number;

    silent?: boolean;
    triggerEvent?: boolean;

    tooltip?: {
        show?: boolean;
    };

    axisLabel?: AxisLabelBaseOption;

    axisPointer?: CommonAxisPointerOption;
    axisLine?: AxisLineOption;
    axisTick?: AxisTickOption;
    minorTick?: MinorTickOption;
    splitLine?: SplitLineOption;
    minorSplitLine?: MinorSplitLineOption;
    splitArea?: SplitAreaOption;

    /**
     * Min value of the axis. can be:
     * + ScaleDataValue
     * + 'dataMin': use the min value in data.
     * + null/undefined: auto decide min value (consider pretty look and boundaryGap).
     */
    min?: ScaleDataValue | 'dataMin' | ((extent: {min: number, max: number}) => ScaleDataValue);
    /**
     * Max value of the axis. can be:
     * + ScaleDataValue
     * + 'dataMax': use the max value in data.
     * + null/undefined: auto decide max value (consider pretty look and boundaryGap).
     */
    max?: ScaleDataValue | 'dataMax' | ((extent: {min: number, max: number}) => ScaleDataValue);

}

export interface NumericAxisBaseOptionCommon extends AxisBaseOptionCommon {
    /*
     * The gap at both ends of the axis.
     * [GAP, GAP], where
     * `GAP` can be an absolute pixel number (like `35`), or percent (like `'30%'`)
     */
    boundaryGap?: [number | string, number | string]

    /**
     * AxisTick and axisLabel and splitLine are caculated based on splitNumber.
     */
    splitNumber?: number;
    /**
     * Interval specifies the span of the ticks is mandatorily.
     */
    interval?: number;
    /**
     * Specify min interval when auto calculate tick interval.
     */
    minInterval?: number;
    /**
     * Specify max interval when auto calculate tick interval.
     */
    maxInterval?: number;

    /**
     * If align ticks to the first axis that is not use alignTicks
     * If all axes has alignTicks: true. The first one will be applied.
     *
     * Will be ignored if interval is set.
     */
    alignTicks?: boolean
}

export interface CategoryAxisBaseOption extends AxisBaseOptionCommon {
    type?: 'category';
    boundaryGap?: boolean
    axisLabel?: AxisLabelOption<'category'> & {
        interval?: 'auto' | number | ((index: number, value: string) => boolean)
    };
    data?: (OrdinalRawValue | {
        value: OrdinalRawValue;
        textStyle?: TextCommonOption;
    })[];
    /*
     * Set false to faster category collection.
     * Only usefull in the case like: category is
     * ['2012-01-01', '2012-01-02', ...], where the input
     * data has been ensured not duplicate and is large data.
     * null means "auto":
     * if axis.data provided, do not deduplication,
     * else do deduplication.
     */
    deduplication?: boolean;

    axisTick?: AxisBaseOptionCommon['axisTick'] & {
        // If tick is align with label when boundaryGap is true
        alignWithLabel?: boolean,
        interval?: 'auto' | number | ((index: number, value: string) => boolean)
    }
}
export interface ValueAxisBaseOption extends NumericAxisBaseOptionCommon {
    type?: 'value';
    axisLabel?: AxisLabelOption<'value'>;

    /**
     * Optional value can be:
     * + `false`: always include value 0.
     * + `false`: always include value 0.
     */
     scale?: boolean;
}
export interface LogAxisBaseOption extends NumericAxisBaseOptionCommon {
    type?: 'log';
    axisLabel?: AxisLabelOption<'log'>;
    logBase?: number;
}
export interface TimeAxisBaseOption extends NumericAxisBaseOptionCommon {
    type?: 'time';
    axisLabel?: AxisLabelOption<'time'>;
}
interface AxisNameTextStyleOption extends TextCommonOption {
    rich?: Dictionary<TextCommonOption>
}

interface AxisLineOption {
    show?: boolean | 'auto',
    onZero?: boolean,
    onZeroAxisIndex?: number,
    // The arrow at both ends the the axis.
    symbol?: string | [string, string],
    symbolSize?: number[],
    symbolOffset?: string | number | (string | number)[],
    lineStyle?: LineStyleOption,
}

interface AxisTickOption {
    show?: boolean | 'auto',
    // Whether axisTick is inside the grid or outside the grid.
    inside?: boolean,
    // The length of axisTick.
    length?: number,
    lineStyle?: LineStyleOption
}

type AxisLabelValueFormatter = (value: number, index: number) => string;
type AxisLabelCategoryFormatter = (value: string, index: number) => string;

// export type AxisLabelFormatterOption = string | ((value: OrdinalRawValue | number, index: number) => string);
type TimeAxisLabelUnitFormatter = AxisLabelValueFormatter | string[] | string;

export type TimeAxisLabelFormatterOption = string
    | ((value: number, index: number, extra: {level: number}) => string)
    | {
        year?: TimeAxisLabelUnitFormatter,
        month?: TimeAxisLabelUnitFormatter,
        week?: TimeAxisLabelUnitFormatter,
        day?: TimeAxisLabelUnitFormatter,
        hour?: TimeAxisLabelUnitFormatter,
        minute?: TimeAxisLabelUnitFormatter,
        second?: TimeAxisLabelUnitFormatter,
        millisecond?: TimeAxisLabelUnitFormatter,
        inherit?: boolean
    };

type LabelFormatters = {
    value: AxisLabelValueFormatter | string
    log: AxisLabelValueFormatter | string
    category: AxisLabelCategoryFormatter | string
    time: TimeAxisLabelFormatterOption
};

interface AxisLabelBaseOption extends Omit<TextCommonOption, 'color'> {
    show?: boolean,
    // Whether axisLabel is inside the grid or outside the grid.
    inside?: boolean,
    rotate?: number,
    // true | false | null/undefined (auto)
    showMinLabel?: boolean,
    // true | false | null/undefined (auto)
    showMaxLabel?: boolean,
    margin?: number,
    rich?: Dictionary<TextCommonOption>
    /**
     * If hide overlapping labels.
     */
    hideOverlap?: boolean;
    // Color can be callback
    color?: ColorString | ((value?: string | number, index?: number) => ColorString)
}
interface AxisLabelOption<TType extends OptionAxisType> extends AxisLabelBaseOption {
    formatter?: LabelFormatters[TType]
}

interface MinorTickOption {
    show?: boolean,
    splitNumber?: number,
    length?: number,
    lineStyle?: LineStyleOption
}

interface SplitLineOption {
    show?: boolean,
    interval?: 'auto' | number | ((index:number, value: string) => boolean)
    // colors will display in turn
    lineStyle?: LineStyleOption<ZRColor | ZRColor[]>
}

interface MinorSplitLineOption {
    show?: boolean,
    lineStyle?: LineStyleOption
}

interface SplitAreaOption {
    show?: boolean,
    interval?: 'auto' | number | ((index:number, value: string) => boolean)
    // colors will display in turn
    areaStyle?: AreaStyleOption<ZRColor[]>
}

export type AxisBaseOption = ValueAxisBaseOption | LogAxisBaseOption
    | CategoryAxisBaseOption | TimeAxisBaseOption | AxisBaseOptionCommon;


text:
NS_ASSUME_NONNULL_BEGIN

@interface MIHTestsHelperCertificatesAssetAccessor__AlgorithmNames : NSObject
@property (copy, nonatomic, readonly, class) NSString *es256;
@property (copy, nonatomic, readonly, class) NSString *es384;
@property (copy, nonatomic, readonly, class) NSString *es512;
@end

@interface MIHTestsHelperCertificatesAssetAccessor : NSObject
@property (copy, nonatomic, readwrite) NSString *folder;
- (instancetype)initWithFolder:(NSString *)folder;
- (instancetype)initWithAlgorithmType:(NSString *)type shaSize:(NSNumber *)size;
- (instancetype)initWithAlgorithName:(NSString *)name;
@end

@interface MIHTestsHelperCertificatesAssetAccessor (Validation)
- (instancetype)checked;
- (BOOL)check;
@end

@interface MIHTestsHelperCertificatesAssetAccessor (FolderAccess)
- (NSString *)stringFromFileWithName:(NSString *)name;
- (NSData *)dataFromFileWithName:(NSString *)name;
@end

@interface MIHTestsHelperCertificatesAssetAccessor (Getters)
@property (copy, nonatomic, readonly) NSString *privateKeyBase64;
@property (copy, nonatomic, readonly) NSString *publicKeyBase64;
@property (copy, nonatomic, readonly) NSString *certificateBase64;
@property (copy, nonatomic, readonly) NSData *p12Data;
@property (copy, nonatomic, readonly) NSString *p12Password;
@end

NS_ASSUME_NONNULL_END


text:
extern NSString const *const BrainCloudServiceNameNone;
extern NSString const *const BrainCloudServiceNameAppStore;
extern NSString const *const BrainCloudServiceNameAuthenticate;
extern NSString const *const BrainCloudServiceNameAuthenticateV2;
extern NSString const *const BrainCloudServiceNameIdentity;
extern NSString const *const BrainCloudServiceNameCurrency;
extern NSString const *const BrainCloudServiceNameFriendData;
extern NSString const *const BrainCloudServiceNameHeartBeat;
extern NSString const *const BrainCloudServiceNameServerTime;
extern NSString const *const BrainCloudServiceNamePushNotification;
extern NSString const *const BrainCloudServiceNameGlobalGameStatistics;
extern NSString const *const BrainCloudServiceNamePlayerStatisticsEvent;
extern NSString const *const BrainCloudServiceNameTwitter;
extern NSString const *const BrainCloudServiceNameSteam;
extern NSString const *const BrainCloudServiceNamePlayerState;
extern NSString const *const BrainCloudServiceNameEntity;
extern NSString const *const BrainCloudServiceNameGlobalEntity;
extern NSString const *const BrainCloudServiceNameFriend;
extern NSString const *const BrainCloudServiceNameTime;
extern NSString const *const BrainCloudServiceNameSocialLeaderboard;
extern NSString const *const BrainCloudServiceNameEvent;
extern NSString const *const BrainCloudServiceNameProduct;
extern NSString const *const BrainCloudServiceNamePlayerStatistics;
extern NSString const *const BrainCloudServiceNameGlobalStatistics;
extern NSString const *const BrainCloudServiceNameAsyncMatch;
extern NSString const *const BrainCloudServiceNameScript;
extern NSString const *const BrainCloudServiceNameMatchMaking;
extern NSString const *const BrainCloudServiceNameOneWayMatch;
extern NSString const *const BrainCloudServiceNamePlaybackStream;
extern NSString const *const BrainCloudServiceNameGamification;
extern NSString const *const BrainCloudServiceNameGlobalApp;
extern NSString const *const BrainCloudServiceNameS3Handling;
extern NSString const *const BrainCloudServiceNameRedemptionCode;
extern NSString const *const BrainCloudServiceNameDataStream;
extern NSString const *const BrainCloudServiceNameProfanity;
extern NSString const *const BrainCloudServiceNameFile;
extern NSString const *const BrainCloudServiceNameVirtualCurrency;


text:
package com.carma.swagger.doclet.model;

import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.ExecutableMemberDoc;

public enum HttpMethod {

	GET("javax.ws.rs.GET"),
	PUT("javax.ws.rs.PUT"),
	POST("javax.ws.rs.POST"),
	DELETE("javax.ws.rs.DELETE"),
	HEAD("javax.ws.rs.HEAD"),
	OPTIONS("javax.ws.rs.OPTIONS"),
	PATCH(".PATCH", true);

	// NOTE Patch is not part of JAXRS 1 or 2 as it stands (people can add it but it will have an arbitrary package)
	// so we will look for any annotation ending in .PATCH

	private final String className;
	private final boolean useContains;

	private HttpMethod(String className) {
		this.className = className;
		this.useContains = false;
	}

	private HttpMethod(String className, boolean useContains) {
		this.className = className;
		this.useContains = useContains;
	}

	/**
	 * This finds a HTTP method for the given method
	 * @param method The java method to check
	 * @return The HTTP method or null if there is not HTTP method annotation on the java method
	 */
	public static HttpMethod fromMethod(ExecutableMemberDoc method) {
		for (AnnotationDesc annotation : method.annotations()) {
			String qName = annotation.annotationType().qualifiedTypeName();
			for (HttpMethod value : HttpMethod.values()) {
				if (value.useContains && qName.contains(value.className)) {
					return value;
				} else if (!value.useContains && qName.equals(value.className)) {
					return value;
				}
			}
		}
		return null;
	}
}