text:
[![Build Status](https://travis-ci.org/yagop/node-telegram-bot-api.svg?branch=master)](https://travis-ci.org/yagop/node-telegram-bot-api) [![Build status](https://ci.appveyor.com/api/projects/status/ujko6bsum3g5msjh/branch/master?svg=true)](https://ci.appveyor.com/project/yagop/node-telegram-bot-api/branch/master) [![Coverage Status](https://coveralls.io/repos/yagop/node-telegram-bot-api/badge.svg?branch=master)](https://coveralls.io/r/yagop/node-telegram-bot-api?branch=master) [![bitHound Score](https://www.bithound.io/github/yagop/node-telegram-bot-api/badges/score.svg)](https://www.bithound.io/github/yagop/node-telegram-bot-api)

Node.js module to interact with official [Telegram Bot API](https://core.telegram.org/bots/api). A bot token is needed, to obtain one, talk to [@botfather](telegram.me/BotFather) and create a new bot.

```sh
npm install node-telegram-bot-api
```

```js
var TelegramBot = require('node-telegram-bot-api');

var token = 'YOUR_TELEGRAM_BOT_TOKEN';
// Setup polling way
var bot = new TelegramBot(token, {polling: true});
bot.on('message', function (msg) {
  var chatId = msg.chat.id;
  // photo can be: a file path, a stream or a Telegram file_id
  var photo = 'bot.gif';
  bot.sendPhoto(chatId, photo, {caption: "I'm a bot!"});
});
```

There are some other examples on [examples](https://github.com/yagop/node-telegram-bot-api/tree/master/examples).

* * *

<!-- Start src/telegram.js -->

## TelegramBot

Both request method to obtain messages are implemented. To use standard polling, set `polling: true`
on `options`. Notice that [webHook](https://core.telegram.org/bots/api#setwebhook) will need a valid (not self signed) SSL certificate.
Emmits `message` when a message arrives.

See: https://core.telegram.org/bots/api

### Params:

* **String** *token* Bot Token
* **Object** *[options]*
* **Boolean|Object** *[options.polling=false]* Set true to enable polling
* **String|Number** *[options.polling.timeout=4]* Polling time
* **Boolean|Object** *[options.webHook=false]* Set true to enable WebHook
* **String** *[options.webHook.key]* PEM private key to webHook server
* **String** *[options.webHook.cert]* PEM certificate key to webHook server

## getMe()

Returns basic information about the bot in form of a `User` object.

### Return:

* **Promise**

## setWebHook(url)

Specify an url to receive incoming updates via an outgoing webHook.

See: https://core.telegram.org/bots/api#setwebhook

### Params:

* **String** *url* URL where Telegram will make HTTP Post. Leave empty to delete webHook.

## getUpdates([timeout], [limit], [offset])

Use this method to receive incoming updates using long polling

See: https://core.telegram.org/bots/api#getupdates

### Params:

* **Number|String** *[timeout]* Timeout in seconds for long polling.
* **Number|String** *[limit]* Limits the number of updates to be retrieved.
* **Number|String** *[offset]* Identifier of the first update to be returned.

### Return:

* **Promise** Updates

## sendMessage(chatId, text, [options])

Send text message.

See: https://core.telegram.org/bots/api#sendmessage

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **Sting** *text* Text of the message to be sent
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## forwardMessage(chatId, fromChatId, messageId)

Forward messages of any kind.

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **Number|String** *fromChatId* Unique identifier for the chat where the original message was sent
* **Number|String** *messageId* Unique message identifier

### Return:

* **Promise**

## sendPhoto(chatId, photo, [options])

Send photo

See: https://core.telegram.org/bots/api#sendphoto

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *photo* A file path or a Stream. Can also be a `file_id` previously uploaded
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## sendAudio(chatId, audio, [options])

Send audio

See: https://core.telegram.org/bots/api#sendaudio

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *audio* A file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## sendDocument(chatId, A, [options])

Send Document

See: https://core.telegram.org/bots/api#sendDocument

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *A* file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## sendSticker(chatId, A, [options])

Send .webp stickers.

See: https://core.telegram.org/bots/api#sendsticker

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *A* file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## sendVideo(chatId, A, [options])

Send video files, Telegram clients support mp4 videos (other formats may be sent whith `sendDocument`)

See: https://core.telegram.org/bots/api#sendvideo

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String|stream.Stream** *A* file path or a Stream. Can also be a `file_id` previously uploaded.
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

## sendChatAction(chatId, action)

Send chat action.
`typing` for text messages,
`upload_photo` for photos, `record_video` or `upload_video` for videos,
`record_audio` or `upload_audio` for audio files, `upload_document` for general files,
`find_location` for location data.

See: https://core.telegram.org/bots/api#sendchataction

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **String** *action* Type of action to broadcast.

### Return:

* **Promise**

## getUserProfilePhotos(userId, [offset], [limit])

Use this method to get a list of profile pictures for a user.
Returns a [UserProfilePhotos](https://core.telegram.org/bots/api#userprofilephotos) object.

See: https://core.telegram.org/bots/api#getuserprofilephotos

### Params:

* **Number|String** *userId* Unique identifier of the target user
* **Number** *[offset]* Sequential number of the first photo to be returned. By default, all photos are returned.
* **Number** *[limit]* Limits the number of photos to be retrieved. Values between 1—100 are accepted. Defaults to 100.

### Return:

* **Promise**

## sendLocation(chatId, latitude, longitude, [options])

Send location.
Use this method to send point on the map.

See: https://core.telegram.org/bots/api#sendlocation

### Params:

* **Number|String** *chatId* Unique identifier for the message recipient
* **Float** *latitude* Latitude of location
* **Float** *longitude* Longitude of location
* **Object** *[options]* Additional Telegram query options

### Return:

* **Promise**

<!-- End src/telegram.js -->


text:
'use strict';

Object.defineProperty(exports, '__esModule', {
  value: true
});
exports.hashFromString = hashFromString;
exports.mergeHash = mergeHash;
exports.replaceEmpty = replaceEmpty;
exports.transformText = transformText;

function hashFromString(path, value, separator, hash) {
  separator = separator || '.';

  if (path.indexOf(separator, path.length - separator.length) >= 0) {
    path = path.slice(0, -separator.length);
  }

  var parts = path.split(separator);
  var tmp_obj = hash || {};
  var obj = tmp_obj;

  for (var x = 0; x < parts.length; x++) {
    if (x === parts.length - 1) {
      tmp_obj[parts[x]] = value;
    } else if (!tmp_obj[parts[x]]) {
      tmp_obj[parts[x]] = {};
    }
    tmp_obj = tmp_obj[parts[x]];
  }
  return obj;
}

function mergeHash(source, target, old) {
  target = target || {};
  old = old || {};

  Object.keys(source).forEach(function (key) {
    if (target[key] !== undefined) {
      if (typeof source[key] === 'object' && source[key].constructor !== Array) {
        var nested = mergeHash(source[key], target[key], old[key]);
        target[key] = nested['new'];
        old[key] = nested.old;
      } else {
        target[key] = source[key];
      }
    } else {
      var pluralMatch = /_plural(_\d+)?$/.test(key);
      var singularKey = key.replace(/_plural(_\d+)?$/, '');

      var contextMatch = /_([^_]+)?$/.test(singularKey);
      var rawKey = singularKey.replace(/_([^_]+)?$/, '');

      if (contextMatch && target[rawKey] !== undefined || pluralMatch && target[singularKey] !== undefined) {
        target[key] = source[key];
      } else {
        old[key] = source[key];
      }
    }
  });

  return {
    'new': target,
    'old': old
  };
}

function replaceEmpty(source, target, transform) {
  target = target || {};

  Object.keys(source).forEach(function (key) {
    if (target[key] !== undefined) {
      if (typeof source[key] === 'object') {
        target[key] = replaceEmpty(source[key], target[key], transform);
      } else if (target[key] === '') {
        var value = source[key];
        if (transform === "uppercase") value = transformText(value);
        target[key] = value;
      }
    }
  });

  return target;
}

function transformText(str) {
  var re = /(.*?(?=<)).*?(?=>)>|(.*)?/gim;
  var m;

  while ((m = re.exec(str)) !== null) {
    if (m.index === re.lastIndex) {
      re.lastIndex++;
    }

    if (m[1]) str = str.replace(m[1], m[1].toUpperCase());
    if (m[2]) str = str.replace(m[2], m[2].toUpperCase());
  }
  return str;
}
//# sourceMappingURL=helpers.js.map

redpajama_set_name: RedPajamaGithub


text:
package xyz.randomcode.dropwizard_morphia.example.resources;

import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class IdResponse {

    private String id;

    @JsonCreator
    public IdResponse(@JacksonInject String id) {
        this.id = id;
    }

    @JsonProperty
    public String getId() {
        return id;
    }
}


text:
source /opt/ros/hydro/setup.bash
roslaunch kobuki_gazebo kobuki_playground.launch


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:fromYDelta="100%p"
               android:toYDelta="0%p"
               android:interpolator="@android:anim/accelerate_decelerate_interpolator"
               android:duration="@android:integer/config_mediumAnimTime"/>
</set>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
in Briganti & Briganti, Historia fungorum regni Neapolitani (Napoli) 81 (1837)

#### Original name
Agaricus tuberculatus F. Brig.

### Remarks
null


text:
package gov.nih.nci.cabig.caaers.web.admin;

import gov.nih.nci.cabig.caaers.domain.Organization;
import gov.nih.nci.cabig.ctms.web.tabs.Flow;

import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.validation.BindException;
import org.springframework.validation.Errors;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author Saurbah Agrawal
 */
public class EditOrganizationController extends OrganizationController<Organization> {

    private static final Log log = LogFactory.getLog(EditOrganizationController.class);

    public EditOrganizationController() {
        setBindOnNewForm(true);
    }

    // /LOGIC

    @Override
    protected Object formBackingObject(final HttpServletRequest request) throws ServletException {
        request.getSession().removeAttribute(getReplacedCommandSessionAttributeName(request));
        Organization organization = organizationDao.getById(Integer.parseInt(request.getParameter("organizationId")));

        if (log.isDebugEnabled()) {
            log.debug("Retrieved Organization :" + String.valueOf(organization));
        }

        return organization;
    }

    @Override
    protected Organization save(final Organization organization, final Errors errors) {
        if (errors.hasErrors()) {
            return organization;
        }
        organizationRepository.createOrUpdate(organization);
        return organization;
    }

    @Override
    protected boolean isSummaryEnabled() {
        return true;
    }

    @Override
    protected void layoutTabs(final Flow<Organization> flow) {
        flow.addTab(new OrganizationTab());
    }

    @SuppressWarnings("unchecked")
	@Override
    protected ModelAndView processFinish(final HttpServletRequest request,
                    final HttpServletResponse response, final Object command,
                    final BindException errors) throws Exception {
    	ModelAndView modelAndView = new ModelAndView("admin/organization_confirmation");
    	if(!errors.hasErrors()){
    		Organization organization = (Organization) command;
    		if("saveRemoteOrg".equals(request.getParameter("_action")) && organization.getId() != null){
    			organizationDao.evict(organization);
    			Organization remoteOrganization = organization.getExternalOrganizations().get(Integer.parseInt(request.getParameter("_selected")));
    			organizationRepository.convertToRemote(organization,remoteOrganization);
    			organization.setName(remoteOrganization.getName());
    			organization.setNciInstituteCode(remoteOrganization.getNciInstituteCode());
    			organization.setDescriptionText(remoteOrganization.getDescriptionText());
    			modelAndView.addAllObjects(errors.getModel());
    			modelAndView.getModel().put("flashMessage", "Successfully synched the Organization");
    		}else{
    			organizationRepository.createOrUpdate(organization);
    			modelAndView.getModel().put("flashMessage", "Successfully updated the Organization");
                modelAndView.addAllObjects(errors.getModel());
    		}
    	}
        return modelAndView;
    }

    @Override
    protected void onBindAndValidate(HttpServletRequest request, Object command, BindException errors, int page) throws Exception {
    	Organization organization = (Organization) command;
    	if("syncOrganization".equals(request.getParameter("_action"))){
    		//TODO: searching only on nci-id , shud be able to search by name or nci-id
    		List<Organization> remoteOrgs = organizationRepository.searchRemoteOrganization(organization.getNciInstituteCode(), "nciInstituteCode");
    		if(remoteOrgs != null && remoteOrgs.size() > 0){
    			organization.setExternalOrganizations(remoteOrgs);
    			errors.reject("REMOTE_ORG_EXISTS","Organization with NCI Institute Code " +organization.getNciInstituteCode()+ " exisits in external system");
    		}
    	}
    }
}


text:
FactoryGirl.define do
  factory :tool do
    name 'Tool Name'
  end
end


text:
namespace EasyDox
{
    public interface IMergeError
    {
        string Accept (IMergeErrorVisitor visitor);
    }
}


text:
import Ember from 'ember';
export default Ember.Controller.extend({
  session: Ember.inject.service()
});


text:
<?php
namespace Kahlan;

use Exception;

class Given
{
    /**
     * The parent scope.
     *
     * @var object
     */
    protected $_parent = null;

    /**
     * The scope's data.
     *
     * @var array
     */
    protected $_data = [];

    /**
     * The given value or a factory closure.
     *
     * @var mixed
     */
    protected $_closure = null;

    /**
     * The Constructor.
     *
     * @param  array $closure A closure.
     *
     * @throws Exception
     */
    public function __construct($closure)
    {
        $this->_closure = $closure;
        if (!is_callable($this->_closure)) {
            throw new Exception("A closure is required by `Given` constructor.");
        }
        $this->_closure = $this->_closure->bindTo($this);
    }

    /**
     * Returns the given data
     *
     * @return mixed
     */
    public function __invoke($parent = null)
    {
        $this->_parent = $parent;
        $closure = $this->_closure;
        return $closure();
    }

    /**
     * Getter.
     *
     * @param  string $key The name of the variable.
     *
     * @return mixed       The value of the variable.
     * @throws Exception
     */
    public function &__get($key)
    {
        if (array_key_exists($key, $this->_data)) {
            return $this->_data[$key];
        }
        if ($this->_parent !== null) {
            return $this->_parent->__get($key);
        }
        throw new Exception("Undefined variable `{$key}`.");
    }

    /**
     * Setter.
     *
     * @param  string $key   The name of the variable.
     * @param  mixed  $value The value of the variable.
     *
     * @return mixed         The value of the variable.
     */
    public function __set($key, $value)
    {
        return $this->_data[$key] = $value;
    }
}


text:
module Azure::ARM::SQL
  module Models
    #
    # Represents the properties of a recommended Azure SQL Database being
    # upgraded.
    #
    class RecommendedDatabaseProperties

      include MsRestAzure

      # @return [String] The name of the Azure SQL database being upgraded.
      attr_accessor :name

      # @return [TargetDatabaseEditions] The target edition for the Azure SQL
      # database being upgraded. Possible values include: 'Basic', 'Standard',
      # 'Premium', 'Free', 'Stretch', 'DataWarehouse'
      attr_accessor :target_edition

      # @return [String] The target Service Level Objective for the Azure SQL
      # database being upgraded.
      attr_accessor :target_service_level_objective

      #
      # Mapper for RecommendedDatabaseProperties class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          required: false,
          serialized_name: 'RecommendedDatabaseProperties',
          type: {
            name: 'Composite',
            class_name: 'RecommendedDatabaseProperties',
            model_properties: {
              name: {
                required: false,
                serialized_name: 'Name',
                type: {
                  name: 'String'
                }
              },
              target_edition: {
                required: false,
                serialized_name: 'TargetEdition',
                type: {
                  name: 'String'
                }
              },
              target_service_level_objective: {
                required: false,
                serialized_name: 'TargetServiceLevelObjective',
                type: {
                  name: 'String'
                }
              }
            }
          }
        }
      end
    end
  end
end


text:
package com.yzong.dsf14.RMIFramework.infra;

import java.io.Console;
import org.apache.commons.lang3.math.NumberUtils;

/**
 * This class contains the Runnable for the RMI Registry Command-Line Interface. It is invoked by
 * the RMI Server main routine.
 *
 * @author Jimmy Zong <yzong@cmu.edu>
 *
 */
public class RMIServerCLI implements Runnable {

  private String RegHostName;
  private int RegPort;
  private String LocalHostName;
  private int LocalPort;
  private volatile RoREntryTable RoRTable;
  private RMIRegistryClient RMIRegClient;

  public RMIServerCLI(String regHostName, int regPort, String localHostName, int localPort,
      RoREntryTable tbl) {
    this.RegHostName = regHostName;
    this.RegPort = regPort;
    this.LocalHostName = localHostName;
    this.LocalPort = localPort;
    this.RoRTable = tbl;
    this.RMIRegClient = LocateRMIRegistry.getRegistry(RegHostName, RegPort);
    if (this.RMIRegClient == null) {
      System.err.printf("ERROR -- Cannot contact the RMI Registry at %s:%d!\n", RegHostName,
          RegPort);
      System.exit(1);
    }
    System.out.println("INFO -- Connection to RMI Server established. CLI started.");
  }

  /**
   * Starts the mainloop for the RMI Registry CLI, where user can register/deregister services on
   * the RMI Server.
   */
  @Override
  public void run() {
    /* Mainloop for RMI Registry CLI. */
    Console console = System.console();
    String input = console.readLine(String.format("RMI Server @ %d > ", LocalPort));
    while (!input.equals("quit") && !input.equals("exit")) {
      String[] command = input.split(" ");
      int tokenLen = command.length;
      /* User feeds empty command. */
      if (tokenLen == 0) {
        continue;
      }
      /* Process `list` command. */
      if (command[0].equals("list")) {
        System.out
            .println("Following are the entries of Remote Object Reference table on local RMI Server:");
        RemoteObjectRef[] rorList = RoRTable.list();
        for (int i = 0; i < rorList.length; i++) {
          System.out.printf("Object Key: %d\n", rorList[i].getObjKey());
          System.out.printf("Remote Interface Name: %s\n", rorList[i].getRemoteInterfaceName());
          System.out.println("");
        }
        if (rorList.length == 0) {
          System.out.println("*** No objects registered on local RMI Server ***\n");
        }
      }
      /* Process `bind` command. */
      else if (command[0].equals("bind")) {
        if (tokenLen != 3) {
          System.out.println("Invalid arguments!");
          System.out.println("Usage: bind ServiceName RemoteObjectClass");
        } else {
          try {
            String srvName = command[1];
            String className = command[2];
            /* Obtains the Remote Implementation Class. */
            Class<?> remoteImpl;
            String remoteIntfClassName = null;
            remoteImpl = Class.forName(className);
            /* Populates RoR Table with the Remote Object. */
            long objKey = RoRTable.addObj(LocalHostName, LocalPort, remoteImpl.newInstance());
            /* Informs RMI Registry that the Service is ready. */
            if (remoteImpl.getInterfaces().length == 1) {
              remoteIntfClassName = remoteImpl.getInterfaces()[0].getName();
              String response =
                  RMIRegClient.bind(srvName, LocalHostName, LocalPort, objKey, remoteIntfClassName);
              if (response.equals("")) {
                System.out.printf("Successfully registered service %s!\n\n", srvName);
              }
              /* If anything fails, revert the change to local RoR Table. */
              else {
                RoRTable.removeObj(new RemoteObjectRef(LocalHostName, LocalPort, objKey,
                    remoteIntfClassName));
                System.out
                    .printf(
                        "Error happened while registering service %s: %s.\nAll changes are reverted.\n\n",
                        srvName, response);
              }
            } else {
              System.out
                  .println("Error: Invalid Remote implementation class! Only one Servant interface is allowed.");
            }
          } catch (Exception e) {
            System.out.printf("Error occured during binding: %s\n", e.getMessage());
          }
        }
      }
      /* Process `rebind` command. */
      else if (command[0].equals("rebind")) {
        if (tokenLen != 3) {
          System.out.println("Invalid arguments!");
          System.out.println("Usage: bind ServiceName RemoteObjectClass");
        } else {
          try {
            String srvName = command[1];
            String className = command[2];
            /* Obtains the Remote Implementation Class. */
            Class<?> remoteImpl;
            String remoteIntfClassName = null;
            remoteImpl = Class.forName(className);
            /* Removes the old Remote Object from RoR Table. */
            RemoteObjectRef oldRoR = RMIRegClient.lookup(srvName);
            if (oldRoR != null) {
              RoRTable.removeObj(oldRoR);
            }
            /* Populates RoR Table with the new Remote Object. */
            long objKey = RoRTable.addObj(LocalHostName, LocalPort, remoteImpl.newInstance());
            /* Informs RMI Registry that the Service is ready. */
            if (remoteImpl.getInterfaces().length == 1) {
              remoteIntfClassName = remoteImpl.getInterfaces()[0].getName();
              String response =
                  RMIRegClient.rebind(srvName, LocalHostName, LocalPort, objKey,
                      remoteIntfClassName);
              if (response.equals("")) {

                System.out.printf("Successfully registered service %s!\n\n", srvName);
              }
              /* If anything fails, revert the change to local RoR Table. */
              else {
                RoRTable.removeObj(new RemoteObjectRef(LocalHostName, LocalPort, objKey,
                    remoteIntfClassName));
                System.out
                    .printf(
                        "Error happened while registering service %s: %s.\nAll changes are reverted.\n\n",
                        srvName, response);
              }
            } else {
              System.out
                  .println("Error: Invalid Remote implementation class! Only one Servant interface is allowed.");
            }
          } catch (Exception e) {
            System.out.printf("Error occured during rebinding: \n", e.getMessage());
          }
        }
      }
      /* Process `unbind` command. */
      else if (command[0].equals("unbind")) {
        if (tokenLen != 2 || !NumberUtils.isNumber(command[1])) {
          System.out.println("Invalid arguments!");
          System.out.println("Usage: unbind ObjectKey");
        } else {
          boolean error;
          /* First look up and remove the local RoR entry. */
          RemoteObjectRef ror = RoRTable.findRoRByObjKey(Long.parseLong(command[1]));
          error = (ror == null) || (!RoRTable.removeObj(ror));
          /* Then remove the reference in RMI Registry. */
          if (error) {
            System.out.printf("Failed to unbind object with Object Key %s in local RoR Table!\n",
                command[1]);
          } else {
            error = true;
            for (String srvName : RMIRegClient.list()) {
              if (ror.equals(RMIRegClient.lookup(srvName))) {
                RMIRegClient.unbind(srvName);
                error = false;
                break;
              }
            }
            if (error) {
              System.out.printf("Failed to unbind object with Object Key %s in RMI Registry!\n\n",
                  command[1]);
            } else {
              System.out.printf("Successfully unbound object with Object Key %s.\n\n", command[1]);
            }
          }
        }
      }
      /* Invalid command. */
      else {
        System.out
            .println("Invalid command! Enter an available command from below for its help message:");
        System.out.println("exit\tquit\tlist\tbind\trebind\tunbind");
      }
      input = console.readLine(String.format("RMI Server @ %d > ", LocalPort));
    }
    System.out.println("Cleaning up RMI Registry...");
    try {
      for (String srvName : RMIRegClient.list()) {
        for (int i = 0; i < RoRTable.list().length; i++) {
          if (RoRTable.list()[i].equals(RMIRegClient.lookup(srvName))) {
            RMIRegClient.unbind(srvName);
            System.out.printf("Unbound service %s from RMI Registry.\n", srvName);
            break;
          }
        }
      }
    } catch (Exception e) {
      /* Ignore any exceptions occured during clean-up phase. */
    } finally {
      System.out.println("Done. Goodbye!");
      System.exit(0);
    }
  }
}


text:
import pytest
import os
import socket
import time
import json
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException

def test_service_elasticsearch_running(host):
    print("\nEnsure Elasticsearch is running...")
    assert host.service("elasticsearch").is_running is True

def test_service_mongodb_running(host):
    print("Ensure MongoDB is running...")
    mongodb_service_name = 'mongod'
    assert host.service(mongodb_service_name).is_running is True

def test_is_graylog_installed(host):
    print("Ensure graylog-server package is installed...")
    assert host.package('graylog-server').is_installed

def test_service_graylog_running(host):
    print("Ensure graylog-server service is running...")
    assert host.service("graylog-server").is_running is True

def test_service_graylog_started(host):
    print("Waiting for Graylog to start up...")
    end_time = time.time() + 90
    server_up = 1

    while server_up != 0 and time.time() < end_time:
        time.sleep(2)
        server_up = host.run_test("cat /var/log/graylog-server/server.log | grep 'Graylog server up and running.'").exit_status

    assert server_up == 0

def test_service_graylog_plugins_loaded(host):
    print("Checking if plugins loaded...")
    results = host.run_test('curl -u admin:admin http://' + host.interface('eth0').addresses[0] + ':9000/api/system/plugins')
    plugins = json.loads(results.stdout)

    enterprise_plugin_loaded = False
    integrations_plugin_loaded = False
    enterprise_integrations_plugin_loaded = False

    for plugin in plugins['plugins']:
      if plugin['name'] == 'Graylog Enterprise':
        enterprise_plugin_loaded = True
        assert os.environ['GRAYLOG_VERSION'] in plugin['version']

      if plugin['name'] == 'Integrations':
        integrations_plugin_loaded = True
        assert os.environ['GRAYLOG_VERSION'] in plugin['version']

      if plugin['name'] == 'Graylog Enterprise':
        enterprise_integrations_plugin_loaded = True
        assert os.environ['GRAYLOG_VERSION'] in plugin['version']

    assert enterprise_plugin_loaded is True
    assert integrations_plugin_loaded is True
    assert enterprise_integrations_plugin_loaded is True

class TestUI():
    url = 'http://localhost:9000'

    def test_title(self, chromedriver):
        print("\nVerifying title text...")
        assert "Getting started" in chromedriver.title

    def test_version(self, chromedriver):
        print('Checking if version is ' + os.environ['GRAYLOG_VERSION'] + '...')
        chromedriver.get(self.url + "/system/overview")

        footer = WebDriverWait(chromedriver, 5).until(expected_conditions.presence_of_element_located((By.XPATH, "//footer"))).text
        assert os.environ['GRAYLOG_VERSION'] in footer

    def test_input_udp(self, chromedriver):
        print('Testing GELF UDP Input...')
        chromedriver.get(self.url + "/system/inputs")

        #Wait for dropdown to load
        WebDriverWait(chromedriver, 5).until(expected_conditions.presence_of_element_located((By.CLASS_NAME, 'form-group')))

        #Click input dropdown
        chromedriver.find_element_by_css_selector(".form-group").click()

        #Click GELF UDP option
        gelf_udp_option = WebDriverWait(chromedriver, 10).until(expected_conditions.presence_of_element_located((By.XPATH, '//div[text()="GELF UDP"]')))
        gelf_udp_option.click()
        #chromedriver.find_element_by_xpath('//div[text()="GELF UDP"]').click()

        #Click "Launch new Input" button
        chromedriver.find_element_by_xpath('//button[text()="Launch new input"]').click()

        #Wait for node dropdown to load
        WebDriverWait(chromedriver, 5).until(expected_conditions.presence_of_element_located((By.ID, 'node-select')))

        #Select node
        chromedriver.find_element_by_xpath("//select[@id='node-select']/option[2]").click()

        #Fill out input field
        try:
            title_field = chromedriver.find_element_by_id("org.graylog2.inputs.gelf.udp.GELFUDPInput-title")
        except (NoSuchElementException):
            #Try the id that was used in <=4.0
            title_field = chromedriver.find_element_by_id("title")

        title_field.send_keys('Test UDP Input')

        #Save form
        title_field.send_keys(Keys.RETURN)

        #Check that the input is there and running.
        WebDriverWait(chromedriver, 15).until(expected_conditions.presence_of_element_located((By.XPATH, '//h2[text()="Test UDP Input"]')))
        input_status = WebDriverWait(chromedriver, 5).until(expected_conditions.presence_of_element_located((By.XPATH, '//span[text()="GELF UDP"]')))
        assert 'RUNNING' in input_status.text

        time.sleep(5)

        #Send something through the input
        for x in range(3):
            socket.socket(socket.AF_INET, socket.SOCK_DGRAM).sendto(b'{ "version": "1.1", "host": "localhost", "short_message": "Hello Graylog!", "level": 5 }', ("127.0.0.1", 12201))

        time.sleep(5)

        #Check if Graylog received it
        chromedriver.get(self.url + "/search?q=&rangetype=relative&relative=0")

        retries = 1
        element = None
        while retries <= 3:
            try:
                element = WebDriverWait(chromedriver, 10).until(expected_conditions.presence_of_element_located((By.XPATH, '//div[text()="Hello Graylog!"]')))
                break
            except TimeoutException:
                chromedriver.refresh()
                retries += 1
        assert 'Hello Graylog!' == element.text


text:
package com.cezarykluczynski.stapi.server.episode.mapper;

import com.cezarykluczynski.stapi.client.v1.soap.EpisodeFull;
import com.cezarykluczynski.stapi.client.v1.soap.EpisodeFullRequest;
import com.cezarykluczynski.stapi.model.episode.dto.EpisodeRequestDTO;
import com.cezarykluczynski.stapi.model.episode.entity.Episode;
import com.cezarykluczynski.stapi.server.character.mapper.CharacterBaseSoapMapper;
import com.cezarykluczynski.stapi.server.common.mapper.DateMapper;
import com.cezarykluczynski.stapi.server.common.mapper.EnumMapper;
import com.cezarykluczynski.stapi.server.common.mapper.RequestSortSoapMapper;
import com.cezarykluczynski.stapi.server.configuration.MapstructConfiguration;
import com.cezarykluczynski.stapi.server.performer.mapper.PerformerBaseSoapMapper;
import com.cezarykluczynski.stapi.server.season.mapper.SeasonBaseSoapMapper;
import com.cezarykluczynski.stapi.server.series.mapper.SeriesBaseSoapMapper;
import com.cezarykluczynski.stapi.server.staff.mapper.StaffBaseSoapMapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(config = MapstructConfiguration.class, uses = {CharacterBaseSoapMapper.class, DateMapper.class, EnumMapper.class, RequestSortSoapMapper.class,
		PerformerBaseSoapMapper.class, SeasonBaseSoapMapper.class, SeriesBaseSoapMapper.class, StaffBaseSoapMapper.class})
public interface EpisodeFullSoapMapper {

	@Mapping(target = "title", ignore = true)
	@Mapping(target = "productionSerialNumber", ignore = true)
	@Mapping(target = "featureLength", ignore = true)
	@Mapping(target = "seasonNumberFrom", ignore = true)
	@Mapping(target = "seasonNumberTo", ignore = true)
	@Mapping(target = "episodeNumberFrom", ignore = true)
	@Mapping(target = "episodeNumberTo", ignore = true)
	@Mapping(target = "stardateFrom", ignore = true)
	@Mapping(target = "stardateTo", ignore = true)
	@Mapping(target = "yearFrom", ignore = true)
	@Mapping(target = "yearTo", ignore = true)
	@Mapping(target = "usAirDateFrom", ignore = true)
	@Mapping(target = "usAirDateTo", ignore = true)
	@Mapping(target = "finalScriptDateFrom", ignore = true)
	@Mapping(target = "finalScriptDateTo", ignore = true)
	@Mapping(target = "sort", ignore = true)
	EpisodeRequestDTO mapFull(EpisodeFullRequest episodeFullRequest);

	EpisodeFull mapFull(Episode episode);

}


text:
<?php

declare(strict_types=1);

namespace Sylius\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20190607135638 extends AbstractMigration
{
    public function up(Schema $schema): void
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('CREATE TABLE sylius_avatar_image (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, type VARCHAR(255) DEFAULT NULL, path VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_1068A3A97E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
        $this->addSql('ALTER TABLE sylius_avatar_image ADD CONSTRAINT FK_1068A3A97E3C61F9 FOREIGN KEY (owner_id) REFERENCES sylius_admin_user (id) ON DELETE CASCADE');
    }

    public function down(Schema $schema): void
    {
        $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('DROP TABLE sylius_avatar_image');
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>FFTW 3.3.8: Cycle Counters</title>

<meta name="description" content="FFTW 3.3.8: Cycle Counters">
<meta name="keywords" content="FFTW 3.3.8: Cycle Counters">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Installation-and-Customization.html#Installation-and-Customization" rel="up" title="Installation and Customization">
<link href="Generating-your-own-code.html#Generating-your-own-code" rel="next" title="Generating your own code">
<link href="Installation-on-non_002dUnix-systems.html#Installation-on-non_002dUnix-systems" rel="prev" title="Installation on non-Unix systems">

Next: Generating your own code, Previous: Installation on non-Unix systems, Up: Installation and Customization   [Contents][Index]

10.3 Cycle Counters

FFTW’s planner actually executes and times different possible FFT
algorithms in order to pick the fastest plan for a given n.  In
order to do this in as short a time as possible, however, the timer must
have a very high resolution, and to accomplish this we employ the
hardware cycle counters that are available on most CPUs.
Currently, FFTW supports the cycle counters on x86, PowerPC/POWER, Alpha,
UltraSPARC (SPARC v9), IA64, PA-RISC, and MIPS processors.

Access to the cycle counters, unfortunately, is a compiler and/or
operating-system dependent task, often requiring inline assembly
language, and it may be that your compiler is not supported.  If you are
not supported, FFTW will by default fall back on its estimator
(effectively using FFTW_ESTIMATE for all plans).

You can add support by editing the file kernel/cycle.h; normally,
this will involve adapting one of the examples already present in order
to use the inline-assembler syntax for your C compiler, and will only
require a couple of lines of code.  Anyone adding support for a new
system to cycle.h is encouraged to email us at fftw@fftw.org.

If a cycle counter is not available on your system (e.g. some embedded
processor), and you don’t want to use estimated plans, as a last resort
you can use the --with-slow-timer option to configure (on
Unix) or #define WITH_SLOW_TIMER in config.h (elsewhere).
This will use the much lower-resolution gettimeofday function, or even
clock if the former is unavailable, and planning will be
extremely slow.

Next: Generating your own code, Previous: Installation on non-Unix systems, Up: Installation and Customization   [Contents][Index]


text:
namespace avl {

	//temp vec
	template<typename _Ty, s::size_t _Dim>
	struct vec {
		static constexpr s::size_t dim = _Dim;
		using cmp_t = _Ty;
		_Ty val[_Dim];

		avl_ainl_res auto operator[](const s::size_t idx) const noexcept -> const _Ty
		{
			return val[idx];
		}

		avl_ainl_res auto operator[](const s::size_t idx) noexcept -> _Ty &
		{
			return val[idx];
		}
	};

	template<typename _Ty>
	using vec2 = vec<_Ty,2>;

	template<typename _Ty>
	using vec3 = vec<_Ty,3>;

	template<typename _Ty>
	using vec4 = vec<_Ty,4>;

	//temp wrapper
	template<typename _Ty, s::size_t _Dim>
	struct vec_w {
		static constexpr s::size_t dim = _Dim;
		using cmp_t = _Ty;
		_Ty * val;

		avl_ainl_res auto operator[](const s::size_t idx) const noexcept -> const _Ty
		{
			return val[idx];
		}

		avl_ainl_res auto operator[](const s::size_t idx) noexcept -> _Ty &
		{
			return val[idx];
		}
	};

	template<typename _Ty>
	using vec2_w = vec_w<_Ty,2>;

	template<typename _Ty>
	using vec3_w = vec_w<_Ty,3>;

	template<typename _Ty>
	using vec4_w = vec_w<_Ty,4>;

	/// \defgroup Type Traits
	/// @{

	/// @name Shortcuts
	/// @{

			/// Get the component type of the vector
//  	template<typename _Tp>
//  	struct cmp_ret { decltype(s::declval<_Tp>()[0]) type; };

//  	//template<>
//  	//struct cmp_ret<__m128> { float type; };

// 	template<typename _Tp>
// 	using cmp_ret_t = typename cmp_ret<_Tp>::type;

	/// Get the component type of the vector (remove extent)
	template<typename _Tp>
	using cmp_t = s::remove_extent_t<_Tp>;

	/// Is scaler
	template<typename _Tp>
	using is_sc = typename s::is_arithmetic<_Tp>;

	/// True type
	using true_t = s::true_type;

	/// False type
	using false_t = s::false_type;

	/// True type if
	template<bool _Cond>
	using true_t_if = s::enable_if_t< _Cond, true_t>;

	template<bool _Cond>
	using true_false_t_if = s::conditional_t< _Cond, true_t, false_t>;

	/// @}
	/// @name Is Euclidean Vector
	/// @{

	template<typename>
	struct is_eu_vec : public false_t {};

	template<typename _Tp, s::size_t _Size>
	struct is_eu_vec<_Tp[_Size]> : true_t_if< is_sc< cmp_t<_Tp> >::value > {};

	template<typename _Tp>
	struct is_eu_vec<_Tp[]> : true_t_if< is_sc< cmp_t<_Tp> >::value > {};

	/// @}
	/// @name Helpers
	/// @{

    template <typename _Tp>
	using rem_const_ref_t = s::remove_const_t< s::remove_reference_t<_Tp> >;

	/// Vector component type equals scalar type
	template <typename _Cmp, typename _Sclr>
	struct eq : s::is_same< rem_const_ref_t<_Cmp> , rem_const_ref_t<_Sclr> > {};

	#include "../compiler/push"
	#include "../compiler/ignore_warning/ignored_attributes"
	template <typename _Tp>
	struct is_simd : eq<_Tp, __m128> {}; //this is still fuzzy
	#include "../compiler/pop"

	template <typename _Tp, typename _Sclr>
	struct is_m128f : true_false_t_if<is_simd<_Tp>::value &&  eq<_Sclr, float>::value> {};

// 	template<typename _Tp, s::size_t _Size>
// 	avl_inl constexpr auto dim(_Tp(&)[_Size]) noexcept -> s::size_t
// 	{
// 		return _Size;
// 	}

// 	template<typename _Tp>
// 	avl_inl constexpr auto dim() noexcept -> s::size_t
// 	{
// 		return decltype(vec)::dim;
// 	}

// 	template<>
// 	avl_inl constexpr auto dim(__m128) noexcept -> s::size_t
// 	{
// 		return 4;
// 	}

	template<typename T>   // primary template
	struct dim
	{
		static constexpr s::size_t value = T::dim;
	};

		template<typename _Tp, s::size_t _Size>   // array
	struct dim<_Tp[_Size]>
	{
		static constexpr s::size_t value = _Size;
	};

	#include "../compiler/push"
	#include "../compiler/ignore_warning/ignored_attributes"
	template<>
	struct dim<__m128>
	{
		static constexpr s::size_t value = 4;
	};
	#include "../compiler/pop"

// 		template<>
// 	struct dim<__m128&>
// 	{
// 		static constexpr s::size_t value = 4;
// 	};

	/// @}

	/// @}
	/// \defgroup Concepts
	/// @{

	/// Concept for scalar types
	template <typename _Tp>
	concept bool sc = is_sc<_Tp>::value;

	/// Concept for wrapped foreign or wrapped vectors.
	/// There needs to be a static member 'dim' of size_t, a type cmp_t for the vectors component type
	/// and the components need to be accessible via the operator[] (const & non-const).
	template <typename _Tp>
	concept bool wrapped_v = requires(_Tp v)
	{
		{ _Tp::dim } -> s::size_t;
		{ v[0] } -> typename _Tp::cmp_t;
		{ v[0] = v[1] }
	};

	/// Concept for vectors (no specific dimension requirement)
	template <typename _Tp>
	concept bool v =
		( is_eu_vec<_Tp>::value && s::extent<_Tp>::value>1) || //for plain arrays
		( wrapped_v<_Tp> ) || //for anything wrapped
		is_simd<_Tp>::value;

	/// Concept for a 2D vector
	template <typename _Tp>
	concept bool v2 =
		(is_eu_vec<_Tp>::value && s::extent<_Tp>::value==2) || //for plain arrays
		( wrapped_v<_Tp> && _Tp::dim==2 ); //for anything wrapped

	/// Concept for a 3D vector
	template <typename _Tp>
	concept bool v3 =
		(is_eu_vec<_Tp>::value && s::extent<_Tp>::value==3) || //for plain arrays
		( wrapped_v<_Tp> && _Tp::dim==3 ); //for anything wrapped

	/// Concept for a 4D vector
	template <typename _Tp>
	concept bool v4 =
		(is_eu_vec<_Tp>::value && s::extent<_Tp>::value==4) || //for plain arrays
		( wrapped_v<_Tp> && _Tp::dim==4 ) || //for anything wrapped
		is_simd<_Tp>::value;

	/// @}
}

#endif // AVL_TRAITS_HPP


text:
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

using System;
using System.Runtime.CompilerServices;

namespace Cysharp.Threading.Tasks.Internal
{
    // optimized version of Standard Queue<T>.
    internal class MinimumQueue<T>
    {
        const int MinimumGrow = 4;
        const int GrowFactor = 200;

        T[] array;
        int head;
        int tail;
        int size;

        public MinimumQueue(int capacity)
        {
            if (capacity < 0) throw new ArgumentOutOfRangeException("capacity");
            array = new T[capacity];
            head = tail = size = 0;
        }

        public int Count
        {
            [MethodImpl(MethodImplOptions.AggressiveInlining)]
            get { return size; }
        }

        public T Peek()
        {
            if (size == 0) ThrowForEmptyQueue();
            return array[head];
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Enqueue(T item)
        {
            if (size == array.Length)
            {
                Grow();
            }

            array[tail] = item;
            MoveNext(ref tail);
            size++;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public T Dequeue()
        {
            if (size == 0) ThrowForEmptyQueue();

            int head = this.head;
            T[] array = this.array;
            T removed = array[head];
            array[head] = default(T);
            MoveNext(ref this.head);
            size--;
            return removed;
        }

        void Grow()
        {
            int newcapacity = (int)((long)array.Length * (long)GrowFactor / 100);
            if (newcapacity < array.Length + MinimumGrow)
            {
                newcapacity = array.Length + MinimumGrow;
            }
            SetCapacity(newcapacity);
        }

        void SetCapacity(int capacity)
        {
            T[] newarray = new T[capacity];
            if (size > 0)
            {
                if (head < tail)
                {
                    Array.Copy(array, head, newarray, 0, size);
                }
                else
                {
                    Array.Copy(array, head, newarray, 0, array.Length - head);
                    Array.Copy(array, 0, newarray, array.Length - head, tail);
                }
            }

            array = newarray;
            head = 0;
            tail = (size == capacity) ? 0 : size;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        void MoveNext(ref int index)
        {
            int tmp = index + 1;
            if (tmp == array.Length)
            {
                tmp = 0;
            }
            index = tmp;
        }

        void ThrowForEmptyQueue()
        {
            throw new InvalidOperationException("EmptyQueue");
        }
    }
}


text:
########################################################################
#
# Linux on Hyper-V and Azure Test Code, ver. 1.0.0
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
# Licensed under the Apache License, Version 2.0 (the ""License"");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#     http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
# ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#
########################################################################

<#
.Synopsis

.Description
        This is a PowerShell test case script that runs on the on
    the ICA host rather than the VM.

    DN_HonorMaxMem  will check to see if VM's Assigned memory of VM does not get incresed beyon Max memory assigned under pressure

    The ICA scripts will always pass the vmName, hvServer, and a
    string of testParams to the PowerShell test case script. For
    example, if the <testParams> section was written as:
          <testParams>
                <param>vm1Name=OpenSuse-DM-VM1</param>
               <param>vm1MinMem=256MB</param>
               <param>vm1MaxMem=9000MB</param>
               <param>vm1StartMem=9000MB</param>
               <param>vm1MemWeight=100</param>
           </testParams>
    The string passed in the testParams variable to the PowerShell
    test case script script would be:

        "HeartBeatTimeout=60;TestCaseTimeout=300"

    Thes PowerShell test case cripts need to parse the testParam
    string to find any parameters it needs.

    All setup and cleanup scripts must return a boolean ($true or $false)
    to indicate if the script completed successfully or not.

.Parameter vmName

.Parameter hvServer

.Parameter testParams

.Example

#>

param([string] $vmName, [string] $hvServer, [string] $testParams)

#######################################################################
#
# ConvertToMemSize()
#
# Description:
#    Convert a string from one of the following formats to
#    a long int:
#        1024MB - Memory size in MB
#        1GB    - Memory size in GB
#        50%    - Memory size as a percent of system memory
#
#######################################################################
function ConvertToMemSize([String] $memString, [Int64] $memCapacity)
{
    $memSize = [Int64] 0

    if ($memString.EndsWith("MB"))
    {
        $num = $memString.Replace("MB","")
        $memSize = ([Convert]::ToInt64($num)) * 1MB
    }
    elseif ($memString.EndsWith("GB"))
    {
        $num = $memString.Replace("GB","")
        $memSize = ([Convert]::ToInt64($num)) * 1GB
    }
    elseif( $memString.EndsWith("%"))
    {
        $memPercent = [Convert]::ToDouble("0." + $memString.Replace("%",""))
        $num = [Int64] ($memPercent * $memCapacity)

        # Align on a 2MB boundry
        $memSize = [Int64](([Int64] ($num / 2MB)) * 2MB)
    }
    else
    {
        $memSize = -1
    }

    return $memSize
}
#
########################################################################
function checkresult()
{
    $stateFile     = "state.txt"
    $TestCompleted = "TestCompleted"
    $TestAborted   = "TestAborted"
    $TestRunning   = "TestRunning"
    $timeout       = 6000

    "Info :   pscp -q -i ssh\${sshKey} root@${ipv4}:$stateFile} ."
    while ($timeout -ne 0 )
    {
    bin\pscp -q -i ssh\${sshKey} root@${ipv4}:${stateFile} . #| out-null
    $sts = $?
    if ($sts)
    {
        if (test-path $stateFile)
        {
            $contents = Get-Content -Path $stateFile
            if ($null -ne $contents)
            {
                    if ($contents -eq $TestCompleted)
                    {

                        "Error :Hot Add should not have succed "
                         return $False

                    }

                    if ($contents -eq $TestAborted)
                    {
                         "Info : Hot add failed. "
                         return $True

                    }
                    #Start-Sleep -s 1
                    $timeout--

                    if ($timeout -eq 0)
                    {
                        "Error : Timed out on Test Running , Exiting test execution."
                        #exit
                        return $False

                    }

            }
            else
            {
                LogMsg 6 "Warn : state file is empty"
                return $False
            }
            del $stateFile -ErrorAction "SilentlyContinue"
        }
        else
        {
             "Warn : ssh reported success, but state file was not copied"
             return $False
        }
    }
    else #
    {
        "Error : pscp exit status = $sts"
        "Error : unable to pull state.txt from VM."
        return $False
    }
    }
}

########################################################################

#######################################################################
##
# Create a script to run the stress tool.
# Copy the script to the Linux VM
# convery eol to the Linux format
# start the the pressure tool on the VM
# Stress tool
#######################################################################
function runtest ()
{
    #"stressapptest -s 60 " | out-file -encoding ASCII -filepath startstress.sh
    .\bin\pscp -i ssh\${sshKey} .\remote-scripts\ica\hot_add_memory.sh root@${ipv4}:
    if (-not $?)
    {
      "Error: Unable to copy startstress.sh to the VM"
       return $False
    }
#del startstress.sh

#.\bin\plink -i ssh\${sshKey} root@${ipv4} "dos2unix startstress.sh  2> /dev/null"
    .\bin\plink -i ssh\${sshKey} root@${ipv4} "dos2unix hot_add_memory.sh  2> /dev/null"
    if (-not $?)
    {
        "Error: Unable to run dos2unix on startstress.sh"
        return $False
    }

    .\bin\plink.exe -i ssh\${sshKey} root@${ipv4} "/etc/init.d/atd restart 2> /dev/null"
    if (-not $?)
    {
        "Error: Unable to start atd"
        return $False
    }

#.\bin\plink.exe -i ssh\${sshKey} root@${ipv4} "at -f startstress.sh now 2> /dev/null"
    .\bin\plink.exe -i ssh\${sshKey} root@${ipv4} "at -f hot_add_memory.sh now 2> /dev/null"
    if (-not $?)
    {
        "Error: Unable to submit startstress to atd"
        return $False
    }
     return $True
}

## Function to collect memory matrix

function memorymatrix()
{
# Wait a few seconds to give Hyper-V some time to detect the new
# memory demand from the VM.  Then collect new memory metrics.
#
    Start-Sleep -s 10

    $vm = Get-VM -Name $vmName -ComputerName $hvServer
    if (-not $vm)
    {
        "Error: VM ${vmName} does not exist"
        return $False
    }

    $script:afterDemand = $vm.MemoryDemand
    $script:AfterMaxmem = $vm.MemoryMaximum
    $script:AfterMemoryassigned  = $vm.MemoryAssigned
    $script:afterMinimum = $vm2.MemoryMinimum

    $demandDelta = $afterDemand - $beforeDemand
    "Info : Before memory demand          :${beforeDemand}"
    "Info : After memory demand           :${afterDemand}"
    "Info : Memory Demand change by       :${demandDelta}"
    "Info : Memory Maximum Before Demand  :${MaximumBytes}"
    "Info : Memory Maximum After Demand   :${AfterMaxmem}"
    "Info : Memory Assigned Before Demand :${beforeMemoryassigned}"
    "Info : Memory Assigned After Demand  :${AfterMemoryassigned}"

    return $True
}

#######################################################################
#
# Main script body
#
#######################################################################

$retVal = $false

# Set result to false

$results = "Failed"

# Check input arguments
#
if ($vmName -eq $null)
{
    "Error: VM name is null"
    return $retVal
}

if ($hvServer -eq $null)
{
    "Error: hvServer is null"
    return $retVal
}

$sshKey = $null
$ipv4 = $null

$params = $testParams.Split(";")
foreach ($p in $params)
{
    $fields = $p.Split("=")
       switch ($fields[0].Trim())
    {

    "sshKey" { $sshKey  = $fields[1].Trim() }
    "ipv4"   { $ipv4    = $fields[1].Trim() }
	"rootdir" { $rootDir = $fields[1].Trim() }
    default  {}
    }
}

if ($null -eq $sshKey)
{
    "Error: Test parameter sshKey was not specified"
    return $False
}

if ($null -eq $ipv4)
{
    "Error: Test parameter ipv4 was not specified"
    return $False
}

#
# Change the working directory to where we need to be
#
if (-not (Test-Path $rootDir))
{
    "Error: The directory `"${rootDir}`" does not exist"
    return $False
}

cd $rootDir

# Capture the load on VM befre running stress test .
$vm = Get-VM -Name $vmName -ComputerName $hvServer -ErrorAction SilentlyContinue
if (-not $vm)
{
    "Error: VM ${vmName} does not exist"
    return $False
}

$MaximumBytes = $vm.MemoryMaximum
$beforeDemand = $vm.MemoryDemand
$beforeMemoryassigned  = $vm.MemoryAssigned
$beforeMinimum = $vm.MemoryMinimum

# Issue the rmmod command to remove hv_balloon on the Linux VM

"INFO : Removing hv_balloon from linux VM"
bin\plink.exe -i ssh\${sshKey} root@${ipv4} "rmmod hv_balloon"
if (-not $?)
{
    "ERROR: Removing hv_ballonn"
    return $False
    exit
}

"INFO : After removing hv_balloon running stress to try to Hot-ADD"
### Run the Stress test

$sts = runtest
foreach ($line in $sts)
{
    $line
}
if (-not $($sts[-1]))
    {

        "Error: Running Stress test failed on VM.!!! exiting test case "
        "result = $results"
        exit
    }

#Collect memory matrix
$sts =memorymatrix
foreach ($line in $sts)
{
    $line
}
if (-not $($sts[-1]))
    {
        "Error: Collecting memory matrix failed on VM.!!! exiting test case "
        "result = $results"
        exit
    }

$sts = checkresult
foreach ($line in $sts)
{
    $line
}
if (-not $($sts[-1]))
    {
        "Error: Hot Add Succeeded on VM. check VM logs , exiting test case execution "
        "result = $results"
        exit
    }

## Final Check to see if Assigned memory has not increased.

if ( $AfterMemoryassigned -eq $beforeMemoryassigned  )
{
     "INFO: Memory assigned has not increased after stress test."
     $results = "Passed"
     $retVal = $True
}
else
{
    "Error: Memory Assigned had increased under pressure"
}

#
"Info : Test ${results}"

return $retVal


text:
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.ws.rs.core.AbstractMultivaluedMap;
import javax.ws.rs.core.CacheControl;
import javax.ws.rs.core.Cookie;
import javax.ws.rs.core.EntityTag;
import javax.ws.rs.core.Form;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Link;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.NewCookie;
import javax.ws.rs.core.PathSegment;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import javax.ws.rs.core.Variant;

public class JaxRsFlow {
  String taint() { return "tainted"; }

  private static class ResponseSource {
    static Response taint() { return null; }
  }

  private static class ResponseBuilderSource {
    static Response.ResponseBuilder taint() { return Response.noContent(); }
  }

  private static class IntSource {
    static int taint() { return 0; }
  }

  private static class BooleanSource {
    static boolean taint() { return false; }
  }

  private static class DateSource {
    static Date taint() { return null; }
  }

  private static class SetStringSource {
    static Set<String> taint() { return new HashSet<String>(); }
  }

  static HttpHeaders taint(HttpHeaders h) { return h; }

  static PathSegment taint(PathSegment ps) { return ps; }

  static UriInfo taint(UriInfo ui) { return ui; }

  static Map taint(Map m) { return m; }

  static Link taint(Link l) { return l; }

  static Class taint(Class c) { return c; }

  private static class UriSource {
    static URI taint() throws Exception { return new URI(""); }
  }

  void sink(Object o) {}

  void testResponse() {
    sink(Response.accepted(taint())); // $ hasTaintFlow
    sink(Response.fromResponse(ResponseSource.taint())); // $ hasTaintFlow
    sink(Response.ok(taint())); // $ hasTaintFlow
    sink(Response.ok(taint(), new MediaType())); // $ hasTaintFlow
    sink(Response.ok(taint(), "type")); // $ hasTaintFlow
    sink(Response.ok(taint(), new Variant(new MediaType(), "", ""))); // $ hasTaintFlow
  }

  void testResponseBuilder(MultivaluedMap<String,Object> multivaluedMap, List<Variant> list) throws Exception {
    sink(ResponseBuilderSource.taint().build()); // $ hasTaintFlow
    sink(Response.noContent().entity(taint())); // $ hasTaintFlow
    sink(ResponseBuilderSource.taint().allow(new HashSet<String>())); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().cacheControl(new CacheControl())); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().clone()); // $ hasTaintFlow
    sink(ResponseBuilderSource.taint().contentLocation(new URI(""))); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().cookie()); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().encoding("")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().entity("")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().expires(new Date())); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().header("", "")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().language("")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().lastModified(new Date())); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().link("", "")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().link(new URI(""), "")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().links()); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().location(new URI(""))); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().replaceAll(multivaluedMap)); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().status(400)); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().tag(new EntityTag(""))); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().tag("")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().type("")); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().variant(new Variant(new MediaType(), "", ""))); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().variants(list)); // $ hasValueFlow
    sink(ResponseBuilderSource.taint().variants()); // $ hasValueFlow
  }

  void testHttpHeaders(HttpHeaders h) {
    sink(taint(h).getAcceptableLanguages()); // $ hasTaintFlow
    sink(taint(h).getAcceptableMediaTypes()); // $ hasTaintFlow
    sink(taint(h).getCookies()); // $ hasTaintFlow
    sink(taint(h).getHeaderString("")); // $ hasTaintFlow
    sink(taint(h).getLanguage()); // $ hasTaintFlow
    sink(taint(h).getMediaType()); // $ hasTaintFlow
    sink(taint(h).getRequestHeader("")); // $ hasTaintFlow
    sink(taint(h).getRequestHeaders()); // $ hasTaintFlow
  }

  void testMultivaluedMapAdd(MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
    mm1.add(taint(), "value");
    sink(mm1.keySet().iterator().next()); // $ hasValueFlow
    mm2.add("key", taint());
    sink(mm2.get("key").get(0)); // $ hasValueFlow
  }

  void testMultivaluedMapAddAll(MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2, MultivaluedMap<String, String> mm3) {
    mm1.addAll(taint(), "a", "b");
    sink(mm1.keySet().iterator().next()); // $ hasValueFlow
    List<String> l = new ArrayList<String>();
    l.add(taint());
    mm2.addAll("key", l);
    sink(mm2.get("key").get(0)); // $ hasValueFlow
    mm3.addAll("key", "a", taint());
    sink(mm3.get("key").get(0)); // $ hasValueFlow
  }

  void testMultivaluedMapAddFirst(MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
    mm1.addFirst(taint(), "value");
    sink(mm1.keySet().iterator().next()); // $ hasValueFlow
    mm2.addFirst("key", taint());
    sink(mm2.get("key").get(0)); // $ hasValueFlow
    sink(mm2.getFirst("key")); // $ hasValueFlow
  }

  void testMultivaluedMapputSingle(MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
    mm1.putSingle(taint(), "value");
    sink(mm1.keySet().iterator().next()); // $ hasValueFlow
    mm2.putSingle("key", taint());
    sink(mm2.get("key").get(0)); // $ hasValueFlow
  }

  class MyAbstractMultivaluedMap<K, V> extends AbstractMultivaluedMap<K, V> {
    public MyAbstractMultivaluedMap(Map<K, List<V>> map) {
        super(map);
    }
  }

  void testAbstractMultivaluedMap(Map<String, List<String>> map1, Map<String, List<String>> map2, List<String> list) {
    map1.put(taint(), list);
    AbstractMultivaluedMap<String, String> amm1 = new MyAbstractMultivaluedMap<String, String>(map1);
    sink(amm1.keySet().iterator().next()); // $ hasValueFlow

    list.add(taint());
    map2.put("key", list);
    AbstractMultivaluedMap<String, String> amm2 = new MyAbstractMultivaluedMap<String, String>(map2);
    sink(amm2.get("key").get(0)); // $ hasValueFlow
  }

  void testMultivaluedHashMap(Map<String, String> map1, Map<String, String> map2,
      MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
    map1.put(taint(), "value");
    MultivaluedHashMap<String, String> mhm1 = new MultivaluedHashMap<String, String>(map1);
    sink(mhm1.keySet().iterator().next()); // $ hasValueFlow

    map2.put("key", taint());
    MultivaluedHashMap<String, String> mhm2 = new MultivaluedHashMap<String, String>(map2);
    sink(mhm2.get("key").get(0)); // $ hasValueFlow

    mm1.add(taint(), "value");
    MultivaluedHashMap<String, String> mhm3 = new MultivaluedHashMap<String, String>(mm1);
    sink(mhm3.keySet().iterator().next()); // $ hasValueFlow

    mm2.add("key", taint());
    MultivaluedHashMap<String, String> mhm4 = new MultivaluedHashMap<String, String>(mm2);
    sink(mhm4.get("key").get(0)); // $ hasValueFlow
  }

  void testPathSegment(PathSegment ps1, PathSegment ps2) {
    sink(taint(ps1).getMatrixParameters()); // $ hasTaintFlow
    sink(taint(ps2).getPath()); // $ hasTaintFlow
  }

  void testUriInfo(UriInfo ui, UriInfo untaintedUriInfo) throws Exception {
    ui = taint(ui);
    sink(ui.getPathParameters()); // $ hasTaintFlow
    sink(ui.getPathSegments()); // $ hasTaintFlow
    sink(ui.getQueryParameters()); // $ hasTaintFlow
    sink(ui.getRequestUri()); // $ hasTaintFlow
    sink(ui.getRequestUriBuilder()); // $ hasTaintFlow
    sink(ui.getQueryParameters().getFirst("someKey")); // $ hasTaintFlow
    sink(ui.getRequestUri()); // $ hasTaintFlow
    sink(ui.getRequestUriBuilder().build()); // $ hasTaintFlow
    URI taintedUri = UriSource.taint();
    URI untaintedUri = new URI("");
    sink(untaintedUriInfo.relativize(taintedUri)); // $ hasTaintFlow
    sink(untaintedUriInfo.resolve(taintedUri)); // $ hasTaintFlow
    sink(ui.resolve(untaintedUri)); // $ hasTaintFlow
  }

  void testCookie() {
    sink(new Cookie(taint(), "", "", "", 0)); // $ hasTaintFlow
    sink(new Cookie("", taint(), "", "", 0)); // $ hasTaintFlow
    sink(new Cookie("", "", taint(), "", 0)); // $ hasTaintFlow
    sink(new Cookie("", "", "", taint(), 0)); // $ hasTaintFlow
    sink(new Cookie("", "", "", "", IntSource.taint())); // $ hasTaintFlow
    sink(new Cookie(taint(), "", "", "")); // $ hasTaintFlow
    sink(new Cookie("", taint(), "", "")); // $ hasTaintFlow
    sink(new Cookie("", "", taint(), "")); // $ hasTaintFlow
    sink(new Cookie("", "", "", taint())); // $ hasTaintFlow
    sink(new Cookie(taint(), "")); // $ hasTaintFlow
    sink(new Cookie("", taint())); // $ hasTaintFlow
    sink(Cookie.valueOf(taint())); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).getDomain()); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).getName()); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).getPath()); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).getValue()); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).getVersion()); // $ hasTaintFlow
    sink(Cookie.valueOf(taint()).toString()); // $ hasTaintFlow
  }

  void testNewCookie() {
    sink(new NewCookie(Cookie.valueOf(taint()))); // $ hasTaintFlow

    sink(new NewCookie(Cookie.valueOf(taint()), "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), taint(), 0, false)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", IntSource.taint(), true)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", 0, BooleanSource.taint())); // $ hasTaintFlow

    sink(new NewCookie(Cookie.valueOf(taint()), "", 0, new Date(), true, true)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), taint(), 0, new Date(), true, false)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", IntSource.taint(), new Date(), false, true)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", 0, DateSource.taint(), false, false)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", 0, new Date(), BooleanSource.taint(), false)); // $ hasTaintFlow
    sink(new NewCookie(Cookie.valueOf(""), "", 0, new Date(), true, BooleanSource.taint())); // $ hasTaintFlow

    sink(new NewCookie(taint(), "")); // $ hasTaintFlow
    sink(new NewCookie("", taint())); // $ hasTaintFlow

    sink(new NewCookie(taint(), "", "", "", 0, "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie("", taint(), "", "", 0, "", 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", taint(), "", 0, "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", taint(), 0, "", 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", IntSource.taint(), "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, taint(), 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", IntSource.taint(), true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", 0, BooleanSource.taint())); // $ hasTaintFlow

    sink(new NewCookie(taint(), "", "", "", 0, "", 0, new Date(), true, true)); // $ hasTaintFlow
    sink(new NewCookie("", taint(), "", "", 0, "", 0, new Date(), false, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", taint(), "", 0, "", 0, new Date(), true, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", taint(), 0, "", 0, new Date(), false, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", IntSource.taint(), "", 0, new Date(), true, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, taint(), 0, new Date(), true, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", IntSource.taint(), new Date(), false, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", 0, DateSource.taint(), false, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", 0, new Date(), BooleanSource.taint(), true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", 0, "", 0, new Date(), false, BooleanSource.taint())); // $ hasTaintFlow

    sink(new NewCookie(taint(), "", "", "", "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie("", taint(), "", "", "", 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", taint(), "", "", 0, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", taint(), "", 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", taint(), 0, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", "", IntSource.taint(), true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", "", 0, BooleanSource.taint())); // $ hasTaintFlow

    sink(new NewCookie(taint(), "", "", "", "", 0, true, true)); // $ hasTaintFlow
    sink(new NewCookie("", taint(), "", "", "", 0, false, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", taint(), "", "", 0, true, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", taint(), "", 0, false, false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", taint(), 0, true, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", "", IntSource.taint(), false, true)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", "", 0, BooleanSource.taint(), false)); // $ hasTaintFlow
    sink(new NewCookie("", "", "", "", "", 0, true, BooleanSource.taint())); // $ hasTaintFlow

    sink(NewCookie.valueOf(taint()).getComment()); // $ hasTaintFlow
    sink(NewCookie.valueOf(taint()).getExpiry()); // $ hasTaintFlow
    sink(NewCookie.valueOf(taint()).getMaxAge()); // $ hasTaintFlow
    sink(NewCookie.valueOf(taint()).toCookie()); // $ hasTaintFlow
    sink(NewCookie.valueOf(taint())); // $ hasTaintFlow
  }

  void testForm(MultivaluedMap<String, String> mm1, MultivaluedMap<String, String> mm2) {
    sink(new Form(taint(), "")); // $ hasTaintFlow
    sink(new Form("", taint())); // $ hasTaintFlow
    mm1.add(taint(), "value");
    sink(new Form(mm1)); // $ hasTaintFlow
    mm2.add("key", taint());
    sink(new Form(mm2)); // $ hasTaintFlow
    Form f1 = new Form(taint(), "");
    sink(f1.asMap()); // $ hasTaintFlow
    Form f2 = new Form();
    sink(f2.param(taint(), "b")); // $ hasTaintFlow
    Form f3 = new Form();
    sink(f3.param("a", taint())); // $ hasTaintFlow
    Form f4 = new Form(taint(), "");
    sink(f4.param("a", "b")); // $ hasTaintFlow
  }

  void testGenericEntity() {
    Method m = Dummy.class.getMethods()[0];
    GenericEntity<Set<String>> ge = new GenericEntity<Set<String>>(SetStringSource.taint(), m.getGenericReturnType());
    sink(ge); // $ hasTaintFlow
    sink(ge.getEntity()); // $ hasTaintFlow
  }

  void testMediaType(Map<String, String> m) {
    sink(new MediaType(taint(), "")); // $ hasTaintFlow
    sink(new MediaType("", taint())); // $ hasTaintFlow
    sink(new MediaType(taint(), "", m)); // $ hasTaintFlow
    sink(new MediaType("", taint(), m)); // $ hasTaintFlow
    sink(new MediaType("", "", taint(m))); // $ hasTaintFlow
    sink(new MediaType(taint(), "", "")); // $ hasTaintFlow
    sink(new MediaType("", taint(), "")); // $ hasTaintFlow
    sink(new MediaType("", "", taint())); // $ hasTaintFlow
    sink(MediaType.valueOf(taint()).getParameters()); // $ hasTaintFlow
    sink(MediaType.valueOf(taint()).getSubtype()); // $ hasTaintFlow
    sink(MediaType.valueOf(taint()).getType()); // $ hasTaintFlow
    sink(MediaType.valueOf(taint())); // $ hasTaintFlow
  }

  void testUriBuilder() throws Exception {
    sink(UriBuilder.fromPath("").build(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").build("", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").build(taint(), false)); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").build("", taint(), true)); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).build("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).build("", false)); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").buildFromEncoded(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").buildFromEncoded("", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).buildFromEncoded("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").buildFromEncodedMap(taint(new HashMap<String, String>()))); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).buildFromEncodedMap(new HashMap<String, String>())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").buildFromMap(taint(new HashMap<String, String>()), false)); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).buildFromMap(new HashMap<String, String>(), true)); // $ hasTaintFlow

    sink(UriBuilder.fromPath(taint()).clone()); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").fragment(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).fragment("")); // $ hasTaintFlow
    sink(UriBuilder.fromLink(taint(Link.valueOf("")))); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromUri(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").host(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).host("")); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").matrixParam(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").matrixParam("", "", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).matrixParam("", "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").path(taint(Dummy.class))); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").path(Dummy.class, taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).path(Dummy.class)); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").queryParam(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").queryParam("", "", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).queryParam("", "")); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").replaceMatrix(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).replaceMatrix("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replaceMatrixParam(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replaceMatrixParam("", "", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).replaceMatrixParam("", "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replacePath(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).replacePath("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replaceQuery(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).replaceQuery("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replaceQueryParam(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").replaceQueryParam("", "", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).replaceQueryParam("", "")); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").resolveTemplate(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplate(taint(), "", false)); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplate("", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplate("", taint(), true)); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplate("", "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplate("", "", false)); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplateFromEncoded(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplateFromEncoded("", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplateFromEncoded("", "")); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").resolveTemplates(taint(new HashMap<String, Object>()))); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplates(taint(new HashMap<String, Object>()), true)); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplates(new HashMap<String, Object>())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplates(new HashMap<String, Object>(), false)); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").resolveTemplatesFromEncoded(taint(new HashMap<String, Object>()))); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).resolveTemplatesFromEncoded(new HashMap<String, Object>())); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").scheme(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).scheme("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").schemeSpecificPart(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).schemeSpecificPart("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").segment(taint(), "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").segment("", "", taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).segment("", "")); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).toTemplate()); // $ hasTaintFlow

    sink(UriBuilder.fromPath("").uri(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).uri("")); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").uri(UriSource.taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).uri(new URI(""))); // $ hasTaintFlow
    sink(UriBuilder.fromPath("").userInfo(taint())); // $ hasTaintFlow
    sink(UriBuilder.fromPath(taint()).userInfo("")); // $ hasTaintFlow
  }
}

class Dummy {
  private static Set<String> foo() { return null; }
}


text:
void mergePalette(const TPaletteP &targetPalette, std::map<int, int> &indexTable,
				  const TPaletteP &sourcePalette, const std::set<int> &sourceIndices)
{
	assert(targetPalette);
	assert(targetPalette->getPageCount() > 0);

	indexTable[0] = 0;
	std::set<int>::const_iterator styleIt = sourceIndices.begin();
	for (styleIt; styleIt != sourceIndices.end(); ++styleIt) {
		int srcStyleId = *styleIt;
		if (srcStyleId == 0)
			continue;
		assert(0 <= srcStyleId && srcStyleId < sourcePalette->getStyleCount());
		TColorStyle *srcStyle = sourcePalette->getStyle(srcStyleId);
		assert(srcStyle);
		TPalette::Page *page = sourcePalette->getStylePage(srcStyleId);
		if (page) {
			std::wstring pageName = page->getName();
			int j = 0;
			for (j = 0; j < targetPalette->getPageCount(); j++) {
				if (targetPalette->getPage(j)->getName() != pageName)
					continue;
				break;
			}
			if (j < targetPalette->getPageCount())
				page = targetPalette->getPage(j);
			else
				page = targetPalette->addPage(pageName);
		} else
			page = targetPalette->getPage(0);
		int tarStyleId = 0;
		int i = 0;
		for (i = 0; i < targetPalette->getStyleCount(); i++)
			if (*srcStyle == *targetPalette->getStyle(i) && i == srcStyleId)
				break;
		if (i < targetPalette->getStyleCount())
			tarStyleId = i;
		else {
			TColorStyle *dstStyle = srcStyle->clone();
			tarStyleId = targetPalette->addStyle(dstStyle);
			page->addStyle(tarStyleId);
			targetPalette->setDirtyFlag(true);
		}
		assert(indexTable.count(srcStyleId) == 0);
		indexTable[srcStyleId] = tarStyleId;
	}
}

//------------------------------------------------------------------------
// replace palette and lacking amount of styles will be copied from the other one
// return value will be true if the style amount is changed after the operation

bool mergePalette_Overlap(
	const TPaletteP &dstPalette,
	const TPaletteP &copiedPalette,
	bool keepOriginalPalette)
{
	if (!dstPalette || !copiedPalette)
		return false;

	bool styleAdded = false;

	int dstStyleCount = dstPalette->getStyleCount();
	int copiedStyleCount = copiedPalette->getStyleCount();

	//keep original
	if (keepOriginalPalette) {
		// do nothing if the style amount of the dst is equal or larger than the copied
		if (dstStyleCount >= copiedStyleCount) {
			return false;
		}
		// if the style amount of the dst is less than the copied
		else {
			//for lacking amount of styles
			for (int i = dstStyleCount; i < copiedStyleCount; i++) {
				//get the page index of the copied style
				TPalette::Page *tmpPage = copiedPalette->getStylePage(i);
				//clone copied style
				TColorStyle *tmpStyle = copiedPalette->getStyle(i)->clone();
				//add it to the dst
				int id = dstPalette->addStyle(tmpStyle);
				//add to the page if it is not deleted in the copied
				if (tmpPage)
					dstPalette->getPage(0)->addStyle(id);
			}

			styleAdded = true;
		}
	}

	//replace
	else {
		//if the style amount of the dst is larger than the copied
		if (dstStyleCount > copiedStyleCount) {
			TPalette *tmpPalette = copiedPalette->clone();

			//for lacking amount of styles
			for (int i = copiedStyleCount; i < dstStyleCount; i++) {
				TColorStyle *tmpStyle = dstPalette->getStyle(i)->clone();
				int id = tmpPalette->addStyle(tmpStyle);

				TPalette::Page *tmpPage = dstPalette->getStylePage(i);
				if (!tmpPage)
					continue;
				std::wstring pageName = tmpPage->getName();
				//create new page with the same name if needed
				int p;
				for (p = 0; p < tmpPalette->getPageCount(); p++) {
					if (tmpPalette->getPage(p)->getName() == pageName)
						break;
				}
				if (p != tmpPalette->getPageCount())
					tmpPalette->getPage(p)->addStyle(id);
				else {
					tmpPalette->addPage(pageName)->addStyle(id);
				}
			}
			dstPalette->assign(tmpPalette);

			styleAdded = false;
		}
		// if the style amount of the dst is equal or less than the copied
		else {
			dstPalette->assign(copiedPalette.getPointer());

			styleAdded = (dstStyleCount < copiedStyleCount);
		}
	}
	dstPalette->setDirtyFlag(true);
	return styleAdded;
}


text:
from __future__ import unicode_literals

from django.db import models
from django.test import TestCase

from rest_framework import serializers
from tests.models import RESTFrameworkModel
# Models
from tests.test_multitable_inheritance import ChildModel

# Regression test for #4290

class ChildAssociatedModel(RESTFrameworkModel):
    child_model = models.OneToOneField(ChildModel, on_delete=models.CASCADE)
    child_name = models.CharField(max_length=100)

# Serializers
class DerivedModelSerializer(serializers.ModelSerializer):
    class Meta:
        model = ChildModel
        fields = ['id', 'name1', 'name2', 'childassociatedmodel']

class ChildAssociatedModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = ChildAssociatedModel
        fields = ['id', 'child_name']

# Tests
class InheritedModelSerializationTests(TestCase):

    def test_multitable_inherited_model_fields_as_expected(self):
        """
        Assert that the parent pointer field is not included in the fields
        serialized fields
        """
        child = ChildModel(name1='parent name', name2='child name')
        serializer = DerivedModelSerializer(child)
        self.assertEqual(set(serializer.data.keys()),
                         set(['name1', 'name2', 'id', 'childassociatedmodel']))


text: Github pages repo with a wasm build and the old js makepad things.


text:
package edu.iu.grid.oim.model.db;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import org.apache.log4j.Logger;

import edu.iu.grid.oim.model.UserContext;
import edu.iu.grid.oim.model.db.record.CampusGridSubmitNodeRecord;
import edu.iu.grid.oim.model.db.record.RecordBase;
import edu.iu.grid.oim.model.db.record.VORecord;

public class CampusGridSubmitNodeModel extends SmallTableModelBase<CampusGridSubmitNodeRecord> {
    static Logger log = Logger.getLogger(CampusGridSubmitNodeModel.class);

	public CampusGridSubmitNodeModel(UserContext context) {
		super(context, "campusgrid_submitnode");
	}
	CampusGridSubmitNodeRecord createRecord() throws SQLException
	{
		return new CampusGridSubmitNodeRecord();
	}
	public ArrayList<CampusGridSubmitNodeRecord> getAll() throws SQLException
	{
		ArrayList<CampusGridSubmitNodeRecord> list = new ArrayList<CampusGridSubmitNodeRecord>();
		for(RecordBase it : getCache()) {
			list.add((CampusGridSubmitNodeRecord)it);
		}
		return list;
	}
	public ArrayList<CampusGridSubmitNodeRecord> getAllByCampusGridID(int campusgrid_id) throws SQLException
	{
		ArrayList<CampusGridSubmitNodeRecord> list = new ArrayList<CampusGridSubmitNodeRecord>();
		for(CampusGridSubmitNodeRecord it : getAll()) {
			if(it.campusgrid_id.compareTo(campusgrid_id) == 0) {
				list.add(it);
			}
		}
		return list;
	}
	/*
    public String getName()
    {
    	return "CampusGrid SubmitNode";
    }
	public Boolean hasLogAccess(XPath xpath, Document doc) throws XPathExpressionException
	{
		Integer id = Integer.parseInt((String)xpath.evaluate("//Keys/Key[Name='resource_id']/Value", doc, XPathConstants.STRING));
		ResourceModel model = new ResourceModel(context);
		return model.canEdit(id);
	}
	public String getHumanValue(String field_name, String value) throws NumberFormatException, SQLException
	{
		if(field_name.equals("resource_id")) {
			ResourceModel model = new ResourceModel(context);
			ResourceRecord rec = model.get(Integer.parseInt(value));
			return value + " (" + rec.name + ")";
		}
		return value;
	}
	*/
}


text:
@interface JKUpdateUserInfoVM : JKViewModel
@property (nonatomic, strong) NSString *genderStr;
@property (nonatomic, strong) NSString *nickNameStr;
@property (nonatomic, strong) NSString *introStr;
@property (nonatomic, strong) NSString *photoStr;

- (void)userInfoGenderRequestWithSuccessBlock:(ReturnSuccessBlock)successBlock withFailureBlock:(ReturnFailureBlock)failureBlock;
- (void)userInfoModifyNameRequestWithSuccessBlock:(ReturnSuccessBlock)successBlock withFailureBlock:(ReturnFailureBlock)failureBlock;
- (void)userInfoIntroRequestWithSuccessBlock:(ReturnSuccessBlock)successBlock withFailureBlock:(ReturnFailureBlock)failureBlock;
- (void)userInfoHeadImgVRequestWithSuccessBlock:(ReturnSuccessBlock)successBlock withFailureBlock:(ReturnFailureBlock)failureBlock;
@end


text:
"""
Created on Wed Jul  1 10:29:20 2015

@author: John Swoboda
"""
from SimISR import Path
import scipy as sp
import scipy.fftpack as scfft
import scipy.interpolate as spinterp
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
sns.set_context("notebook")

from SimISR.utilFunctions import MakePulseDataRep,CenteredLagProduct,readconfigfile,spect2acf
from ISRSpectrum.ISRSpectrum import ISRSpectrum

inifile= "../Testdata/PFISRExample.pickle"

def main():

    (sensdict,simparams) = readconfigfile(inifile)
    simdtype = simparams['dtype']
    sumrule = simparams['SUMRULE']
    npts = simparams['numpoints']
    amb_dict = simparams['amb_dict']
    # for spectrum
    ISS2 = ISRSpectrum(centerFrequency = 440.2*1e6, bMag = 0.4e-4, nspec=npts, sampfreq=sensdict['fs'],dFlag=True)
    ti = 2e3
    te = 2e3
    Ne = 1e11
    Ni = 1e11

    datablock90 = sp.array([[Ni,ti],[Ne,te]])
    species = simparams['species']

    (omega,specorig,rcs) = ISS2.getspecsep(datablock90, species,rcsflag = True)

    cur_filt = sp.sqrt(scfft.ifftshift(specorig*npts*npts*rcs/specorig.sum()))
    #for data
    Nrep = 10000
    pulse = sp.ones(14)
    lp_pnts = len(pulse)
    N_samps = 100
    minrg = -sumrule[0].min()
    maxrg = N_samps+lp_pnts-sumrule[1].max()
    Nrng2 = maxrg-minrg;
    out_data = sp.zeros((Nrep,N_samps+lp_pnts),dtype=simdtype)
    samp_num = sp.arange(lp_pnts)
    for isamp in range(N_samps):
        cur_pnts = samp_num+isamp
        cur_pulse_data = MakePulseDataRep(pulse,cur_filt,rep=Nrep)
        out_data[:,cur_pnts] = cur_pulse_data+out_data[:,cur_pnts]

    lagsData = CenteredLagProduct(out_data,numtype=simdtype,pulse =pulse)
    lagsData=lagsData/Nrep # divide out the number of pulses summed
    Nlags = lagsData.shape[-1]
    lagsDatasum = sp.zeros((Nrng2,Nlags),dtype=lagsData.dtype)
    for irngnew,irng in enumerate(sp.arange(minrg,maxrg)):
        for ilag in range(Nlags):
            lagsDatasum[irngnew,ilag] = lagsData[irng+sumrule[0,ilag]:irng+sumrule[1,ilag]+1,ilag].mean(axis=0)
    lagsDatasum=lagsDatasum/lp_pnts # divide out the pulse length
    (tau,acf) = spect2acf(omega,specorig)

    # apply ambiguity function
    tauint = amb_dict['Delay']
    acfinterp = sp.zeros(len(tauint),dtype=simdtype)

    acfinterp.real =spinterp.interp1d(tau,acf.real,bounds_error=0)(tauint)
    acfinterp.imag =spinterp.interp1d(tau,acf.imag,bounds_error=0)(tauint)
    # Apply the lag ambiguity function to the data
    guess_acf = sp.zeros(amb_dict['Wlag'].shape[0],dtype=sp.complex128)
    for i in range(amb_dict['Wlag'].shape[0]):
        guess_acf[i] = sp.sum(acfinterp*amb_dict['Wlag'][i])

#    pdb.set_trace()
    guess_acf = guess_acf*rcs/guess_acf[0].real

    # fit to spectrums
    spec_interm = scfft.fftshift(scfft.fft(guess_acf,n=npts))
    spec_final = spec_interm.real
    allspecs = scfft.fftshift(scfft.fft(lagsDatasum,n=len(spec_final),axis=-1),axes=-1)
#    allspecs = scfft.fftshift(scfft.fft(lagsDatasum,n=npts,axis=-1),axes=-1)
    fig = plt.figure()
    plt.plot(omega,spec_final.real,label='In',linewidth=5)
    plt.hold(True)
    plt.plot(omega,allspecs[40].real,label='Out',linewidth=5)
    plt.axis((omega.min(),omega.max(),0.0,2e11))
    plt.show(False)

if __name__== '__main__':

    main()


text:
package com.mongodb.client;

import com.mongodb.ClientEncryptionSettings;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.vault.ClientEncryption;
import com.mongodb.client.vault.ClientEncryptions;

public class ClientSideEncryptionExplicitEncryptionTest extends AbstractClientSideEncryptionExplicitEncryptionTest {

    @Override
    protected MongoClient createMongoClient(final MongoClientSettings settings) {
        return MongoClients.create(settings);
    }

    @Override
    protected ClientEncryption createClientEncryption(final ClientEncryptionSettings settings) {
        return ClientEncryptions.create(settings);
    }
}


text:
/**
 *
 */
package com.juxtapose.example.ch06.flat;

import org.springframework.batch.item.file.separator.RecordSeparatorPolicy;

/**
 * @author bruce.liu(mailto:jxta.liu@gmail.com)
 * 2013-4-5下午10:01:21
 */
public class MultiLineRecordSeparatorPolicy implements RecordSeparatorPolicy {
	private String delimiter = ",";
	private int count = 0;

	/* (non-Javadoc)
	 * @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#isEndOfRecord(java.lang.String)
	 */
	public boolean isEndOfRecord(String line) {
		return countDelimiter(line) == count;
	}

	/* (non-Javadoc)
	 * @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#postProcess(java.lang.String)
	 */
	public String postProcess(String record) {
		return record;
	}

	/* (non-Javadoc)
	 * @see org.springframework.batch.item.file.separator.RecordSeparatorPolicy#preProcess(java.lang.String)
	 */
	public String preProcess(String record) {
		return record;
	}

	private int countDelimiter(String s) {
		String tmp = s;
		int index = -1;
		int count = 0;
		while ((index=tmp.indexOf(","))!=-1) {
			tmp = tmp.substring(index+1);
			count++;
		}
		return count;
	}

	public String getDelimiter() {
		return delimiter;
	}

	public int getCount() {
		return count;
	}

	public void setDelimiter(String delimiter) {
		this.delimiter = delimiter;
	}

	public void setCount(int count) {
		this.count = count;
	}
}