text:
 //%DEFINE-START%
var scn_pkg="org.scn.community.";if(sap.firefly!=undefined){scn_pkg=scn_pkg.replace(".","_");}
define([
	"sap/designstudio/sdk/component",
	"./TopFlopSpec",
	"../../../"+scn_pkg+"shared/modules/component.core",
	"../../../"+scn_pkg+"shared/modules/component.basics",
	"../../../"+scn_pkg+"shared/modules/component.databound"

	],
	function(
		Component,
		spec,
		core,
		basics
	) {
//%DEFINE-END%

var myComponentData = spec;

TopFlop = {

	renderer: {},

	initDesignStudio: function() {
		var that = this;

		org_scn_community_basics.fillDummyDataInit(that, that.initAsync);
	},

	initAsync: function (owner) {
		var that = owner;
		org_scn_community_component_Core(that, myComponentData);

		/* COMPONENT SPECIFIC CODE - START(initDesignStudio)*/
		that._lLayout = new sap.ui.layout.VerticalLayout({

		});
		/* COMPONENT SPECIFIC CODE - END(initDesignStudio)*/

		that.onAfterRendering = function () {
			org_scn_community_basics.resizeContentAbsoluteLayout(that, that._lLayout, that.onResize);
		}
	},

	afterDesignStudioUpdate: function() {
		var that = this;

		/* COMPONENT SPECIFIC CODE - START(afterDesignStudioUpdate)*/
		var loadingResultset = "DataCellList";

		var data = undefined;
		if(loadingResultset == "ResultSet" || loadingResultset == "ResultCell"){
			data = that.getData();
		} else if(loadingResultset == "DataCellList"){
			data = that.getDataCellList();
		}

		var metadata = that.getDSMetadata();

		if(!org_scn_community_databound.hasData (data, metadata)) {
			org_scn_community_databound.getSampleDataFlat (that, that.processData, that.afterPrepare, "result");
		} else {
			org_scn_community_basics.fillDummyData(that, that.processData, that.afterPrepare);
		}
		/* COMPONENT SPECIFIC CODE - START(afterDesignStudioUpdate)*/
	},

	/* COMPONENT SPECIFIC CODE - START METHODS*/
	processData: function (flatData, afterPrepare, owner) {
		var that = owner;

		if(flatData == undefined) {
			var loadingResultset = "DataCellList";

			if(loadingResultset == "ResultSet"){
				var options = org_scn_community_databound.initializeOptions();
				options.swapAxes = that.getSwapAxes();

				that._flatData = org_scn_community_databound.flatten(that.getData(), options);
			} else if(loadingResultset == "ResultCell"){
				that._flatData = that.getData();
			} else if(loadingResultset == "DataCellList"){
				that._options = org_scn_community_databound.initializeOptions();
				var options = that._options;

				options.iMaxNumber = that.getMaxNumber();
				options.iTopBottom = that.getTopBottom().replace(" ", "").replace("X", "");
				options.allKeys = true;
				options.idPrefix = that.getId();
				options.iSortBy = "Value";
				options.iDuplicates = "Ignore";
				options.iIgnoreAverage = that.getIgnoreAverage();
				options.iNumberOfDecimals = parseInt(that.getValueDecimalPlaces().replace("D", ""));

				options.average = that.getFixedAverage();
				if(options.average == -1) {
					options.average = undefined;
				}

				options.iDisplayText = "Text";

				var dataList = that.getDataCellList();
				that._metaData = that.getDSMetadata();

				that._returnObject = org_scn_community_databound.getTopBottomElementsForDimension (dataList, that._metaData, "", options);
			}
		} else {
			var lData = flatData;
			that._metaData = flatData;

			that._options = org_scn_community_databound.initializeOptions();
			var options = that._options;

			options.iMaxNumber = that.getMaxNumber();
			options.iTopBottom = that.getTopBottom().replace(" ", "").replace("X", "");
			options.iSortBy = "Value";
			options.iSortBy = "Value";
			options.iDuplicates = "Ignore";
			options.iNumberOfDecimals = parseInt(that.getValueDecimalPlaces().replace("D", ""));

			options.average = that.getFixedAverage();
			if(options.average == -1) {
				options.average = undefined;
			}

			options.iDisplayText = "Text";

			that._returnObject = org_scn_community_databound.getTopBottomElementsForDimension (lData, that._metaData, "", options);
		}

		// processing on data
		if(that._oResize) {
			that._oResize(true, true);
		}
	},

	afterPrepare: function (owner) {
		var that = owner;

		var rerender = true;
		if(rerender) {
			that._oElements = {};

			that._maxValue = undefined;
			that._maxDelta = -1;

			lElementsToRenderArray = that._returnObject.list;

			// Destroy old content
			that._lLayout.destroyContent();

			// find highest value
			for (var i = 0; i < lElementsToRenderArray.length; i++) {
				var element = lElementsToRenderArray[i];
				if(that._maxValue == undefined) {
					that._maxValue = element.value;
				}
				if(element.value > that._maxValue) {
					that._maxValue = element.value;
				}
			}

			if(that._maxValue == 0) {
				that._maxValue = 1;
			}

			// distribute content
			for (var i = 0; i < lElementsToRenderArray.length; i++) {
				var element = lElementsToRenderArray[i];
				var lImageElement = that.createLeaderElement(that, i, element.key, element.text, element.url, element.value, element.valueS, element.counter, element.delta, that._returnObject);
				that._oElements[element.key] = lImageElement;
				that._lLayout.addContent(lImageElement);
			}

			// insert Average Information
			var oText = new sap.ui.commons.TextView();
			oText.addStyleClass("scn-pack-DataTopFlop-AverageText");

			var fixedAverage = that.getFixedAverage();
			if(fixedAverage == -1) {
				if(that._returnObject) {
					oText.setText(that.getAveragePrefix() + org_scn_community_basics.getFormattedValue(that._returnObject.average, that._metaData.locale, that._options.iNumberOfDecimals) + that.getAverageSuffix());
				} else {
					oText.setText(that.getAveragePrefix() + org_scn_community_basics.getFormattedValue(0, "en", that._options.iNumberOfDecimals) + that.getAverageSuffix());
				}
			} else {
				oText.setText(that.getAveragePrefix() + that.getFixedAverage());
			}

			that._lLayout.addContent(
					oText
			);
		} else {
			for (lElementKey in that._oElements) {
				var lElement = that._oElements[lElementKey];

				if(that.getSelectedKey() == lElement.internalKey) {
					lElement.addStyleClass("scn-pack-DataTopFlop-SelectedValue");
				} else {
					lElement.removeStyleClass("scn-pack-DataTopFlop-SelectedValue");
				}
			}
		}
	},

	onResize: function(width, height, parent) {
		if(parent._returnObject == undefined) {return;}
		try{
			parent.afterPrepare(parent);
		}catch (e) {
			alert(e + ", " + e.stack);
		}
	},

	createLeaderElement: function (owner, index, iImageKey, iImageText, iImageUrl, value, valueAsString, counter, delta, returnObject) {
		var that = owner;

		iImageUrl = org_scn_community_basics.getRepositoryImageUrlPrefix(that, that.getFallbackPicture(), iImageUrl, "TopFlop.png");

		var lAllowInteraction = that.getAllowInteraction();

		var lUsePictures = that.getUsePictures();
		var lAddCounter = that.getAddCounter();

		var lLeftMargin = "35px";
		var lLeftMarginPicture = "35px";

		if(lUsePictures && lAddCounter) {
			lLeftMargin = "72px";
			lLeftMarginPicture = "35px";
		} else if (lUsePictures) {
			lLeftMargin = "38px";
			lLeftMarginPicture = "2px";
		} else if (lAddCounter) {
			lLeftMargin = "35px";
			lLeftMarginPicture = "2px";
		}

		var oLayout = new sap.zen.commons.layout.AbsoluteLayout ({
			width: (owner._containerWidth-6) + "px",
			height: "40px"
		});

		if(delta < 0) {
			delta = delta * -1;
		}

		var lSizeValueBackground = (owner._containerWidth - 120) * returnObject.maxDelta / returnObject.maxDelta;
		var lSizeValue = (owner._containerWidth - 120) * delta / returnObject.maxDelta;

		var oValueLayout = new sap.zen.commons.layout.AbsoluteLayout ({
			width: lSizeValue + "px",
			height: "3px"
		});

		var oValueLayoutBackground = new sap.zen.commons.layout.AbsoluteLayout ({
			width: lSizeValueBackground + "px",
			height: "3px"
		});

		if(lAllowInteraction) {
			oValueLayoutBackground.addStyleClass("scn-pack-DataTopFlop-ValueLayout");
		} else {
			oValueLayoutBackground.addStyleClass("scn-pack-DataTopFlop-ValueLayoutNoInteraction");
		}

		if(value < returnObject.average) {
			oValueLayout.addStyleClass("scn-pack-DataTopFlop-ValueLayoutBad");
		} else {
			oValueLayout.addStyleClass("scn-pack-DataTopFlop-ValueLayoutGood");
		}

		oLayout.addContent(
				oValueLayoutBackground,
				{right: "2px", bottom: "3px"}
		);
		oLayout.addContent(
				oValueLayout,
				{right: "2px", bottom: "3px"}
		);

		oLayout.addStyleClass("scn-pack-DataTopFlop-Layout");
		oLayout.internalKey = iImageKey;

		if(that.getAddCounter()) {
			var oIndexText = new sap.ui.commons.TextView();
			oIndexText.addStyleClass("scn-pack-DataTopFlop-IndexText");
			oIndexText.setText(counter + ".");

			oLayout.addContent(
					oIndexText,
					{right: (owner._containerWidth-6-25) + "px", top: "10px"}
			);
		}

		var oNameLink = undefined;
		if(lAllowInteraction) {
			oNameLink = new sap.ui.commons.Link();
		} else {
			oNameLink = new sap.ui.commons.TextView();
		}
		oNameLink.addStyleClass("scn-pack-DataTopFlop-Link");

		oLayout.addContent(
				oNameLink,
				{left: lLeftMargin, top: "1px"}
		);

		var oImage = new sap.ui.commons.Image ({
			src : iImageUrl,
			width : "32px",
			height : "32px",
			alt : iImageText,
			tooltip : iImageText,
		});

		oImage.addStyleClass("scn-pack-DataTopFlop-Picture");
		oImage.internalKey = iImageKey;

		if(lUsePictures) {
			oLayout.addContent(
					oImage,
					{left: lLeftMarginPicture, top: "5px"}
			);
		}

		var oText = new sap.ui.commons.TextView();
		oText.addStyleClass("scn-pack-DataTopFlop-Text");

		oLayout.addContent(
				oText,
				{left: lLeftMargin, bottom: "3px"}
		);

		var oTextDeltaValue = new sap.ui.commons.TextView();
		oTextDeltaValue.addStyleClass("scn-pack-DataTopFlop-TextDelta");

		oLayout.addContent(
				oTextDeltaValue,
				{right: "2px", top: "1px"}
		);

		if(that.getSelectedKey() == iImageKey) {
			oLayout.addStyleClass("scn-pack-DataTopFlop-SelectedValue");
		}

		if(lAllowInteraction) {
			oNameLink.attachBrowserEvent('click', function() {
				that._linkEvent = true;
				that.setPressedKey(oImage.internalKey);

				that.fireDesignStudioPropertiesChangedAndEvent(["pressedKey"], "onPress");
			});

			oLayout.attachBrowserEvent('click', function () {
				if(that._linkEvent == true) {
					that._linkEvent = false;
				} else {
					that.setSelectedKey(oImage.internalKey);
					that.updateSelection(that, oImage.internalKey);

					that.fireDesignStudioPropertiesChangedAndEvent(["selectedKey"], "onSelectionChanged");
				}
			});
		}

		oNameLink.setText (iImageText);
		oNameLink.setTooltip (iImageText);

		if(lUsePictures) {
			var requestForPicture = new XMLHttpRequest();

			requestForPicture.onreadystatechange = function() {
				// check status and react
				if (requestForPicture.readyState == 4){
					var imageToLoad = undefined;

					// sometimes it gets 200 without content
					if(requestForPicture.status == 404 || requestForPicture.responseUrl == "" || requestForPicture.response == "") {
						imageToLoad = that.getFallbackPicture();
					} else {
						imageToLoad = iImageUrl;
					};

					oImage.setSrc(imageToLoad);
				};
			};

			// just a check if there is some picture at all
			if(iImageUrl != undefined && iImageUrl != "") {
				requestForPicture.open("GET", iImageUrl, true);
				requestForPicture.send();
			}
		}

		oText.setText (that.getValuePrefix() + valueAsString + that.getValueSuffix());

		var delta = value - returnObject.average;
		if(delta > 0) {
			oTextDeltaValue.setText (" Δ " + "+" + org_scn_community_basics.getFormattedValue(delta, that._metaData.locale, that._options.iNumberOfDecimals) + that.getDeltaValueSuffix());
		} else {
			oTextDeltaValue.setText (" Δ " + org_scn_community_basics.getFormattedValue(delta, that._metaData.locale, that._options.iNumberOfDecimals) + that.getDeltaValueSuffix());
		}

		return oLayout;
	},

	updateSelection : function (owner, iSelectedKey) {
		var that = owner;
		var lContent = that._lLayout.getContent();

		for (var i = 0; i < lContent.length; i++) {
			var lLayout = lContent [i];

			if(iSelectedKey == lLayout.internalKey){
				lLayout.addStyleClass("scn-pack-DataTopFlop-SelectedValue");
			} else {
				lLayout.removeStyleClass("scn-pack-DataTopFlop-SelectedValue");
			};
		};
	},

	_fFormatNumber : function (value) {
		if(!that._metadata) {
			return value;
		}

		sap.common.globalization.NumericFormatManager.setPVL(that._metadata.locale);
		var strFormat = "#"+sap.common.globalization.NumericFormatManager.getThousandSeparator()+"##0";

		var decPlaces = parseInt(that.getValueDecimalPlaces().replace("D", ""));
		if (decPlaces > 0) {
			strFormat += sap.common.globalization.NumericFormatManager.getDecimalSeparator();
			for (var i = 0; i < decPlaces; i++) {
				strFormat += "0";
			}
		}

		var valueFormatted = sap.common.globalization.NumericFormatManager.format(value, strFormat);
		return valueFormatted;
	},

	/* COMPONENT SPECIFIC CODE - END METHODS*/
};

//%INIT-START%
myComponentData.instance = TopFlop;
jQuery.sap.require("sap.zen.commons.layout.AbsoluteLayout");
sap.zen.commons.layout.AbsoluteLayout.extend(myComponentData.fullComponentName, myComponentData.instance);
});


text:
Change Log
==========

Version 1.2.5 *(2016-05-09)*
----------------------------

 * Fix: Correctly emit generated code for binding parameterized types.

Version 1.2.4 *(2016-05-03)*
----------------------------

 * Fix: Restore static injection support to work correctly.

Version 1.2.3 *(2016-05-02)*
----------------------------

 * Fix: Correct detection of module base classes. This previously erroneously failed compilation
   on modules which extended from `Object` but were not detected as such.
 * Fix: Allow the use of dollar signs in processed class names.
 * Fix: Remove the need for `javac` to generate synthetic accessor methods for internal classes.
 * Fix: Error when duplicate classes are listed in `injects=` or `includes=` lists.

Version 1.2.2 *(2014-07-21)*
----------------------------

 * Update JavaWriter to 2.5.0. This fixes incorrectly compressing fully-qualified class names
   in child packages of `java.lang` (e.g., `java.lang.ref.WeakReference`).

Version 1.2.1 *(2014-02-16)*
----------------------------

 * Restore Java 5 compatibility.
 * New: Improve performance of `.plus()` with large volumes of set bindings.
 * Fix: Do not mask underlying exception message from binding problems when constructing a graph.

Version 1.2.0 *(2013-12-13)*
----------------------------

 * Numerous performance improvements in both the compiler and runtime.
   * Use more efficient `String` concatenation.
   * Module adapters are now stateless.
   * Use read/write locks over global locks.
   * Reflective constructor invocation is now cached with `Class.newInstance`.
   * Avoid re-linking all bindings when calling `.plus()`.
 * Set bindings are now unioned when calling `.plus()`.
 * Fix: Tolerate missing type information during compilation by deferring writing
   module adapters.

Version 1.1.0 *(2013-08-05)*
----------------------------

 * Module loading now requires code generation via the 'dagger-compiler' artifact.
 * Allow multiple contributions to Set binding via `Provides.Type.SET_VALUES`.
 * Request classloading from the classloader of the requesting object, not the current thread's
   context classloader.
 * Cache class loading at the root injector to reduce costs of loading adapters.
 * Fix: Primitive array types are no longer incorrectly changed to their boxed type.
 * Update JavaWriter to 2.1.1.

Version 1.0.1 *(2013-06-03)*
----------------------------

 * Explicitly forbid declaring `@Inject` on a class type (e.g., `@Inject class Foo {}`).
 * Update JavaWriter to 1.0.5.

Version 1.0.0 *(2013-05-07)*
----------------------------

Initial release.

redpajama_set_name: RedPajamaGithub


text:
namespace Scheduler.TaskPrioritization.Infrastructure.Tasks
{
    using System;
    using System.Numerics;

    public class CatalanNumbersCalculator
    {
        public int StartValue { get; set; }

        public int EndValue { get; set; }

        public TimeSpan ElapsedTime { get; set; }

        public void Execute()
        {
            for (var i = this.StartValue; i <= this.EndValue; i++)
            {
                var catalanNumber = this.Factorial(2 * i) / (this.Factorial(i + 1) * this.Factorial(i));
            }
        }

        private BigInteger Factorial(int n)
        {
            if (n < 1)
            {
                return 1;
            }

            return n * this.Factorial(n - 1);
        }
    }
}


text:
layout: post
date: '2016-03-27'
title: "SWEET 16 Short Lace One Shoulder Prom Dress In Pink/White"
category: SWEET 16
tags: [SWEET 16]
---
### SWEET 16 Short Lace One Shoulder Prom Dress In Pink/White
Just **$426.99**
###

Buy it: [https://www.eudances.com/en/sweet-16/2488-short-lace-one-shoulder-prom-dress-in-pink-white.html](https://www.eudances.com/en/sweet-16/2488-short-lace-one-shoulder-prom-dress-in-pink-white.html)


text:
/**
 A **Material** defines the surface appearance of attached {{#crossLink "GameObject"}}GameObjects{{/crossLink}}.

 Material is the base class for:

{{#crossLink "PBRMaterial"}}{{/crossLink}} - Physically-based rendering (PBR) material.

{{#crossLink "PhongMaterial"}}{{/crossLink}} - Blinn-Phong shading material.

(more coming)

 @class Material
 @module XEO
 @constructor
 @extends Component
 */
(function () {

    "use strict";

    XEO.Material = XEO.Component.extend({

        className: "XEO.Material",

        type: "material",

        _init: function (cfg) {

        }
    });

})();


text:
require 'open-uri'

class Ranking < ActiveRecord::Base
  include Clear
  belongs_to :source
  belongs_to :player

  validates :overall_rank, presence: true
  #validates :pos_rank, presence: true

  def self.not_ranked? source, player
    results = Ranking.where(source: source,
                            player: player)
    return results.empty?
  end

  def self.populate
    Source.all.each do |source|
      all_players = source.fetch
      all_players += source.fetch('https://fantasy.nfl.com/research/rankings?leagueId=0&statType=draftStats&offset=101') if source.nfl?

      all_players.each do |player|
        next if player.empty?

        found_player = Player.find_player(player).first
        if found_player && found_player.id && Ranking.not_ranked?(source, found_player)
          Ranking.create(source: source,
                         player: found_player,
                         overall_rank: player[:rank].to_i)
        end
      end
    end
    Ranking.all
  end

  def self.get_all_by_player
    @all_ranks = []
    @tolerence = 0.1

    Player.all.each do |player|
      one_rank = {}
      one_rank[:player] = player

      player_ranks = {}
      ranks = Ranking.where(player: player).all
      ranks.each do |rnk|
        player_ranks[rnk.source_id] = rnk.overall_rank
      end

      Source.all.each do |s|
        source_default = Ranking.where(source: s).maximum('overall_rank') * (1+@tolerence)
        player_ranks[s.id] = source_default if player_ranks[s.id].to_i == 0
      end

      one_rank[:overall_rank] = 0
      player_ranks.each do |source_id, val|
        s = Source.find source_id
        one_rank[:overall_rank] = one_rank[:overall_rank] + ((s.weight.to_f/100.0) * val)
      end

      one_rank[:sources] = player_ranks
      @all_ranks << one_rank
    end
    @all_ranks.sort_by { |hsh| hsh[:overall_rank] }
  end
end


text:
<?php

declare(strict_types=1);

namespace Knp\DoctrineBehaviors\Tests\Fixtures\Entity;

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Id;
use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
use Knp\DoctrineBehaviors\Model\Translatable\TranslatableTrait;

#[Entity]
class TranslatableCustomIdentifierEntity implements TranslatableInterface
{
    use TranslatableTrait;

    #[Id]
    #[Column(type: 'integer')]
    #[GeneratedValue(strategy: 'AUTO')]
    private int $idColumn;

    /**
     * @param mixed[] $arguments
     * @return mixed
     */
    public function __call(string $method, array $arguments)
    {
        return $this->proxyCurrentLocaleTranslation($method, $arguments);
    }

    public function getIdColumn(): int
    {
        return $this->idColumn;
    }
}


text:
using namespace std;

template<>
void Disk::save<Item>(tag_type tag, Item* element, std::ofstream& data) {
  save_tag(tag, data);
  if (element == nullptr) {
    save(tag, 0, data);

  } else {
    save(tag, 1, data);
    save(tag, element->o_type, data);
    element->save(data);
  }
}

template<>
bool Disk::load<Item>(tag_type tag, Item*& element, std::ifstream& data) {
  if (!load_tag(tag, data)) { return false; }

  int null_checker;
  load(tag, null_checker, data);
  if (null_checker == 0) {
    return true;
  }

  int type;
  load(tag, type, data);
  switch (type) {
    case IO::Potion: element = new class Potion(data); break;
    case IO::Scroll: element = new class Scroll(data); break;
    case IO::Food:   element = new class Food(data); break;
    case IO::Amulet: element = new class Amulet(data); break;
    case IO::Ammo:   element = new class Weapon(data); break;
    case IO::Weapon: element = new class Weapon(data); break;
    case IO::Armor:  element = new class Armor(data); break;
    case IO::Ring:   element = new class Ring(data); break;
    case IO::Wand:   element = new class Wand(data); break;

    default: error("Unknown item");
  }

  return true;
}


text:
using namespace qglviewer;

#include <fstream>
using namespace std;

#include "commonqtclasses.h"

class NetworkInformation
{
 public :
  NetworkInformation();
  NetworkInformation& operator=(const NetworkInformation&);

  static NetworkInformation interpolate(const NetworkInformation,
					const NetworkInformation,
					float);

  static QList<NetworkInformation> interpolate(const QList<NetworkInformation>,
					       const QList<NetworkInformation>,
					       float);

  void clear();

  void save(fstream&);
  void load(fstream&);

  QString filename;
  float Vopacity, Eopacity;
  int Vatt, Eatt;
  float userVmin, userVmax;
  float userEmin, userEmax;
  QGradientStops Vstops;
  QGradientStops Estops;
  float scalee, scalev;
};

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
  <item
    android:id="@+id/account_menu_log_out"
    android:title="@string/log_out"
    android:icon="@drawable/android:ic_lock_power_off" />
</menu>


text:
Medici is a simple library for obtaining [real-time](http://www.google.com/googlefinance/disclaimer/#realtime) stock quotes and historical data from the (undocumented) [Google Finance API](http://developers.google.com/finance).

## Installation

Medici is packaged as a Gem. Therefore it can be installed manually using RubyGems:

    $ gem install medici

or you can add the line

``` ruby
gem 'medici'
```

to your application's Gemfile and then let Bundler install it by executing `bundle`.

## Usage

Quotes and historical data are represented by `Medici::Stock` and `Medici::Historical` objects respectively. Both classes are immutable and only admit object instantiation through static factory methods, `quote` and `quotes`.

### Stock quote

``` ruby
require 'medici'

google = Medici.quote('GOOG')
tech = Medici.quotes(['GOOG', 'AAPL', 'MSFT', 'FB'])

puts google.last
puts tech.max_by(&:market_cap).company
```

### Historical data

``` ruby
year_to_date = Medici.historical('GOOG', '2013-01-01')
january = Medici.historical('GOOG', '2013-01-01', '2013-01-31')

year_to_date.each do |h|
  puts "#{h.date} \t #{h.close}"
end

january_change = january.last.close - january.first.close
```

## License

Medici is released under the [MIT License](http://www.opensource.org/licenses/MIT).


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mus. Bot. 2:174. 1856

#### Original name
null

### Remarks
null


text:
package org.dcm4chex.archive.hl7;

import java.util.List;

import org.dom4j.Document;
import org.dom4j.Element;
import org.regenstrief.xhl7.HL7XMLLiterate;

public class ACK {

    public final String acknowledgmentCode;
	public final String messageControlID;
	public final String textMessage;

	public ACK(Document msg) {
        Element msa = msg.getRootElement().element("MSA");
        if (msa == null)
                throw new IllegalArgumentException("Missing MSA Segment");
        List fields = msa.elements(HL7XMLLiterate.TAG_FIELD);
        this.acknowledgmentCode = toString(fields.get(0));
        this.messageControlID = toString(fields.get(1));
        this.textMessage = toString(fields.get(1));
     }

    private static String toString(Object el) {
        return el != null ? ((Element) el).getText() : "";
    }

    public String toString() {
    	return "ACK[code=" +  acknowledgmentCode
    			+ ", msgID=" + messageControlID + ','
    			+ ", errorMsg=" + textMessage + "]";
    }
}


text:
module Kafka
  module Clients
    class ProducerRecord
      # @!method initialize(topic, partition, timestamp, key, value)
      #   @return [self]
      #   @overload send(topic, value)
      #     @param topic [String]
      #     @param value [String]
      #     @return [self]
      #   @overload send(topic, key, value)
      #     @param topic [String]
      #     @param key [String]
      #     @param value [String]
      #     @return [self]
      #   @overload send(topic, partition, key, value)
      #     @param topic [String]
      #     @param partition [Integer]
      #     @param key [String]
      #     @param value [String]
      #     @return [self]
      #   @overload send(topic, partition, timestamp, key, value)
      #     @param topic [String]
      #     @param partition [Integer]
      #     @param timestamp [Time, Float]
      #     @param key [String]
      #     @param value [String]
      #     @return [self]

      # @!method topic
      #   @return [String]

      # @!method partition
      #   @return [Integer]

      # @!method timestamp
      #   @return [Time]

      # @!method key
      #   @return [String]

      # @!method value
      #   @return [String]
    end
  end
end


text:
extern crate journal_gateway;

#[test]
fn get_entries() {

    // TODO make this into a self contained test

    let journal_gw = JournalGateway::new("http://192.168.33.19:19531")
        .expect("JournalGateway initialization failed");
    //let res = journal_gw.get_all_entries();

    let filter = vec![("SYSLOG_IDENTIFIER".to_string(), "wash-manager".to_string())];

    let res: Vec<JournalEntry> = journal_gw
        .get_entries(Some(&filter), None)
        .expect("should  have some entries");

    // TODO use asserts to check stuff

    println!("Received {} entries", res.len());
    for entry in res {
        println!("{}: {:?}",
                 entry.syslog_identifier.unwrap_or("N/A".to_string()),
                 entry.message);
    }
    println!("First entry: {:?}\n",
             journal_gw.get_first_entry(Some(&filter)));
    println!("Last entry: {:?}\n",
             journal_gw.get_last_entry(Some(&filter)));
}

// TODO create another test with a filter, e.g.
// let res = journal_gw.get_entries(Some(vec![("_COMM".to_string(), "cat".to_string())]));


text:
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Text.RegularExpressions;

namespace Toolhouse.Monitoring.Dependencies
{
    public class DatabaseDependency : IDependency
    {
        public DatabaseDependency(string name, string connectionStringName)
        {
            this.Name = name;
            this.ConnectionStringName = connectionStringName;
        }

        public string ConnectionStringName
        {
            get;
            private set;
        }

        public string Name
        {
            get;
            private set;
        }

        public DependencyStatus Check()
        {
            var connectionString = ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString;
            var builder = new SqlConnectionStringBuilder(connectionString);

            using (var conn = new SqlConnection(connectionString))
            using (var cmd = conn.CreateCommand())
            {
                cmd.CommandText = "SELECT 1+1";
                conn.Open();
                int result = (int)cmd.ExecuteScalar();

                if (result != 2)
                {
                    throw new Exception("1 + 1 apparently does not equal 2 in this universe.");
                }

                return new DependencyStatus(
                    this,
                    true,
                    string.Format("Using database '{0}'", builder.InitialCatalog)
                );
            }
        }
    }
}


text:
"use strict";

fluid.defaults("flock.drum.app.minimal", {
    gradeNames: "flock.drum.app",

    numVoices: 6,

    components: {
        kit: {
            options: {
                dynamicComponents: {
                    voice: {
                        type: "flock.drum.minimalMonoSynth",
                    }
                }
            }
        },

        mixer: {
            type: "flock.drum.channelMixer",
            options: {
                addToEnvironment: "{kit}.options.numVoices",
                channelSourceBuses: "{kit}.options.voiceBuses.left"
            }
        }
    }
});


text:
using PipServices.Commons.Errors;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace PipServices.Commons.Validate
{
#if CORE_NET
    [DataContract]
#else
    [Serializable]
#endif
    public class ValidationException : BadRequestException
    {
        private static long SerialVersionUid { get; } = -1459801864235223845L;

        public ValidationException(string correlationId, IList<ValidationResult> results) :
            this(correlationId, ComposeMessage(results))
        {
            WithDetails("results", results);
        }

        public ValidationException(string correlationId, string message) :
            base(correlationId, "INVALID_DATA", message)
        {
        }

#if !CORE_NET
        protected ValidationException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        { }
#endif

        public static string ComposeMessage(IList<ValidationResult> results)
        {
            var builder = new StringBuilder();
            builder.Append("Validation failed");

            if (results != null && results.Count > 0)
            {
                var first = true;
                foreach (var result in results)
                {
                    if (result.Type == ValidationResultType.Information)
                        continue;

                    builder.Append(!first ? ": " : ", ");
                    builder.Append(result.Message);
                    first = false;
                }
            }

            return builder.ToString();
        }

        public static void ThrowExceptionIfNeeded(string correlationId, IList<ValidationResult> results, bool strict)
        {
            var hasErrors = false;
            foreach (var result in results)
            {
                if (result.Type == ValidationResultType.Error)
                    hasErrors = true;

                if (strict && result.Type == ValidationResultType.Warning)
                    hasErrors = true;
            }

            if (hasErrors)
                throw new ValidationException(correlationId, results);
        }
    }
}


text:
package com.suncht.convert;

/**
 * 文档转换接口
 * @author changtan.sun
 *
 */
public interface IOfficeDocumentConverter {
	/**
	 * 转换
	 */
	void convert();
}


text:
from argparse import Namespace
import unittest

from migrator import main

class TestMain(unittest.TestCase):
    def test_noop(self):
        """Test that noop function can take variable amount of parameters."""
        test = []
        for i in range(5):
            main.noop(*test)
            test.append(i)

    def test_call_func_system(self):
        args = Namespace()
        args.config = 'a'

        def func(*func_args):
            self.assertEqual(1, len(func_args))
            self.assertEqual('a', func_args[0])

        main.call_func(func, None, 'system', args)

    def test_call_func_master(self):
        args = Namespace()
        args.config = 'b'

        def func(*func_args):
            self.assertEqual(2, len(func_args))
            self.assertEqual('b', func_args[0])
            self.assertEqual('c', func_args[1])

        main.call_func(func, 'c', 'master', args)

    def test_call_func_course(self):
        args = Namespace()
        args.config = 'd'
        args.semester = 'e'
        args.course = 'f'

        def func(*func_args):
            self.assertEqual(4, len(func_args))
            self.assertEqual('d', func_args[0])
            self.assertEqual('g', func_args[1])
            self.assertEqual('e', func_args[2])
            self.assertEqual('f', func_args[3])

        main.call_func(func, 'g', 'course', args)


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />

<link rel="shortcut icon" type="image/x-icon" href="../../../../../favicon.ico" />
<title>ExploreByTouchHelper - Android SDK | Android Developers</title>

<link rel="stylesheet"
href="http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic,mediumitalic,bold" title="roboto">
<link href="../../../../../assets/css/default.css" rel="stylesheet" type="text/css">

<link href="../../../../../assets/css/fullscreen.css" rel="stylesheet" class="fullscreen"
type="text/css">

          	Quicknav
			      Quicknav

                  Design

Develop

Distribute

Links

Google Play Developer Console

Android Developers Blog

About Android

Android Sites

Android.com

Android Developers

Android Open Source Project

      <form onsubmit="return submit_search()">
        <input id="search_autocomplete" type="text" value="" autocomplete="off" name="q"
onfocus="search_focus_changed(this, true)" onblur="search_focus_changed(this, false)"
onkeydown="return search_changed(event, true, '../../../../../')"
onkeyup="return search_changed(event, false, '../../../../../')" />
      </form>

        close

Get Started

Style

Patterns

Building Blocks

Downloads

Videos

Training

API Guides

Reference

Tools

Get the SDK

Google Services

Google Play

Publishing

Promoting

App Quality

Spotlight

Open Distribution

Results

Loading...

Training

API Guides

Reference

Tools

Google Services

to top

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.app

  android.app.admin

  android.app.backup

  android.appwidget

  android.bluetooth

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.display

  android.hardware.input

  android.hardware.location

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.effect

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.service.dreams

  android.service.notification

  android.service.textservice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.v13.app

  android.support.v4.accessibilityservice

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.database

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.media

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.view

  android.support.v7.widget

  android.support.v8.renderscript

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http

  org.apache.http.auth

  org.apache.http.auth.params

  org.apache.http.client

  org.apache.http.client.entity

  org.apache.http.client.methods

  org.apache.http.client.params

  org.apache.http.client.protocol

  org.apache.http.client.utils

  org.apache.http.conn

  org.apache.http.conn.params

  org.apache.http.conn.routing

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.conn.util

  org.apache.http.cookie

  org.apache.http.cookie.params

  org.apache.http.entity

  org.apache.http.impl

  org.apache.http.impl.auth

  org.apache.http.impl.client

  org.apache.http.impl.conn

  org.apache.http.impl.conn.tsccm

  org.apache.http.impl.cookie

  org.apache.http.impl.entity

  org.apache.http.impl.io

  org.apache.http.io

  org.apache.http.message

  org.apache.http.params

  org.apache.http.protocol

  org.apache.http.util

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

DrawerLayout.DrawerListener

SimpleCursorAdapter.CursorToStringConverter

SimpleCursorAdapter.ViewBinder

SlidingPaneLayout.PanelSlideListener

Classes

AutoScrollHelper

ContentLoadingProgressBar

CursorAdapter

DrawerLayout

DrawerLayout.LayoutParams

DrawerLayout.SavedState

DrawerLayout.SimpleDrawerListener

EdgeEffectCompat

ExploreByTouchHelper

ListPopupWindowCompat

ListViewAutoScrollHelper

PopupMenuCompat

ResourceCursorAdapter

ScrollerCompat

SearchViewCompat

SearchViewCompat.OnCloseListenerCompat

SearchViewCompat.OnQueryTextListenerCompat

SimpleCursorAdapter

SlidingPaneLayout

SlidingPaneLayout.LayoutParams

SlidingPaneLayout.SimplePanelSlideListener

ViewDragHelper

ViewDragHelper.Callback

      fullscreen
      Use Tree NavigationUse Panel Navigation

Summary:

  Constants

  | Ctors

  | Methods

  | Protected Methods

  | Inherited Methods

| [Expand All]

    public

    abstract
    class

ExploreByTouchHelper

    extends AccessibilityDelegateCompat

        java.lang.Object

               ↳

        android.support.v4.view.AccessibilityDelegateCompat

               ↳

        android.support.v4.widget.ExploreByTouchHelper

Class Overview

ExploreByTouchHelper is a utility class for implementing accessibility
 support in custom Views that represent a collection of View-like
 logical items. It extends AccessibilityNodeProviderCompat and
 simplifies many aspects of providing information to accessibility services
 and managing accessibility focus. This class does not currently support
 hierarchies of logical items.

 This should be applied to the parent view using
 setAccessibilityDelegate(View, AccessibilityDelegateCompat):

 mAccessHelper = ExploreByTouchHelper.create(someView, mAccessHelperCallback);
 ViewCompat.setAccessibilityDelegate(someView, mAccessHelper);

Summary

Constants

        int
        INVALID_ID
        Virtual node identifier value for invalid nodes.

Public Constructors

        <nobr>

            </nobr>

        <nobr>
        ExploreByTouchHelper(View forView)</nobr>

Factory method to create a new ExploreByTouchHelper.

Public Methods

        <nobr>

            boolean</nobr>

        <nobr>
        dispatchHoverEvent(MotionEvent event)</nobr>

Dispatches hover MotionEvents to the virtual view hierarchy when
 the Explore by Touch feature is enabled.

        <nobr>

            AccessibilityNodeProviderCompat</nobr>

        <nobr>
        getAccessibilityNodeProvider(View host)</nobr>

Returns the AccessibilityNodeProviderCompat for this helper.

        <nobr>

            int</nobr>

        <nobr>
        getFocusedVirtualView()</nobr>

Returns the virtual view id for the currently focused item,

        <nobr>

            void</nobr>

        <nobr>
        invalidateRoot()</nobr>

Notifies the accessibility framework that the properties of the parent
 view have changed.

        <nobr>

            void</nobr>

        <nobr>
        invalidateVirtualView(int virtualViewId)</nobr>

Notifies the accessibility framework that the properties of a particular
 item have changed.

        <nobr>

            boolean</nobr>

        <nobr>
        sendEventForVirtualView(int virtualViewId, int eventType)</nobr>

Populates an event of the specified type with information about an item
 and attempts to send it up through the view hierarchy.

Protected Methods

        <nobr>
            abstract

            int</nobr>

        <nobr>
        getVirtualViewAt(float x, float y)</nobr>

Provides a mapping between view-relative coordinates and logical
 items.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        <a href="../../../../../reference/android/support/v4/widget/ExploreByTouchHelper.html#getVisibleVirtualViews(java.util.List<java.lang.Integer>)">getVisibleVirtualViews(List<Integer> virtualViewIds)</nobr>

Populates a list with the view's visible items.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        onPerformActionForVirtualView(int virtualViewId, int action, Bundle arguments)</nobr>

Performs the specified accessibility action on the item associated
 with the virtual view identifier.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        onPopulateEventForVirtualView(int virtualViewId, AccessibilityEvent event)</nobr>

Populates an AccessibilityEvent with information about the
 specified item.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        onPopulateNodeForVirtualView(int virtualViewId, AccessibilityNodeInfoCompat node)</nobr>

Populates an AccessibilityNodeInfoCompat with information
 about the specified item.

  [Expand]

Inherited Methods

From class

  android.support.v4.view.AccessibilityDelegateCompat

        <nobr>

            boolean</nobr>

        <nobr>
        dispatchPopulateAccessibilityEvent(View host, AccessibilityEvent event)</nobr>

Dispatches an AccessibilityEvent to the host View first and then
 to its children for adding their text content to the event.

        <nobr>

            AccessibilityNodeProviderCompat</nobr>

        <nobr>
        getAccessibilityNodeProvider(View host)</nobr>

Gets the provider for managing a virtual view hierarchy rooted at this View
 and reported to AccessibilityServices
 that explore the window content.

        <nobr>

            void</nobr>

        <nobr>
        onInitializeAccessibilityEvent(View host, AccessibilityEvent event)</nobr>

Initializes an AccessibilityEvent with information about the
 the host View which is the event source.

        <nobr>

            void</nobr>

        <nobr>
        onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info)</nobr>

Initializes an AccessibilityNodeInfoCompat with information about the host view.

        <nobr>

            void</nobr>

        <nobr>
        onPopulateAccessibilityEvent(View host, AccessibilityEvent event)</nobr>

Gives a chance to the host View to populate the accessibility event with its
 text content.

        <nobr>

            boolean</nobr>

        <nobr>
        onRequestSendAccessibilityEvent(ViewGroup host, View child, AccessibilityEvent event)</nobr>

Called when a child of the host View has requested sending an
 AccessibilityEvent and gives an opportunity to the parent (the host)
 to augment the event.

        <nobr>

            boolean</nobr>

        <nobr>
        performAccessibilityAction(View host, int action, Bundle args)</nobr>

Performs the specified accessibility action on the view.

        <nobr>

            void</nobr>

        <nobr>
        sendAccessibilityEvent(View host, int eventType)</nobr>

Sends an accessibility event of the given type.

        <nobr>

            void</nobr>

        <nobr>
        sendAccessibilityEventUnchecked(View host, AccessibilityEvent event)</nobr>

Sends an accessibility event.

From class

  java.lang.Object

        <nobr>

            Object</nobr>

        <nobr>
        clone()</nobr>

Creates and returns a copy of this Object.

        <nobr>

            boolean</nobr>

        <nobr>
        equals(Object o)</nobr>

Compares this instance with the specified object and indicates if they
 are equal.

        <nobr>

            void</nobr>

        <nobr>
        finalize()</nobr>

Invoked when the garbage collector has detected that this instance is no longer reachable.

        <nobr>

            final

            Class<?></nobr>

        <nobr>
        getClass()</nobr>

Returns the unique instance of Class that represents this
 object's class.

        <nobr>

            int</nobr>

        <nobr>
        hashCode()</nobr>

Returns an integer hash code for this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        notify()</nobr>

Causes a thread which is waiting on this object's monitor (by means of
 calling one of the wait() methods) to be woken up.

        <nobr>

            final

            void</nobr>

        <nobr>
        notifyAll()</nobr>

Causes all threads which are waiting on this object's monitor (by means
 of calling one of the wait() methods) to be woken up.

        <nobr>

            String</nobr>

        <nobr>
        toString()</nobr>

Returns a string containing a concise, human-readable description of this
 object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait()</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis, int nanos)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

        <nobr>

            final

            void</nobr>

        <nobr>
        wait(long millis)</nobr>

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
 specified timeout expires.

Constants

        public
        static
        final
        int

        INVALID_ID

Virtual node identifier value for invalid nodes.

        Constant Value:

                -2147483648
                (0x80000000)

Public Constructors

        public

      ExploreByTouchHelper
      (View forView)

Factory method to create a new ExploreByTouchHelper.

Parameters

          forView
          View whose logical children are exposed by this helper.

Public Methods

        public

        boolean

      dispatchHoverEvent
      (MotionEvent event)

Dispatches hover MotionEvents to the virtual view hierarchy when
 the Explore by Touch feature is enabled.

 This method should be called by overriding
 dispatchHoverEvent(MotionEvent):

@Override
 public boolean dispatchHoverEvent(MotionEvent event) {
   if (mHelper.dispatchHoverEvent(this, event) {
     return true;
   }
   return super.dispatchHoverEvent(event);
 }

Parameters

          event
          The hover event to dispatch to the virtual view hierarchy.

Returns

Whether the hover event was handled.

        public

        AccessibilityNodeProviderCompat

      getAccessibilityNodeProvider
      (View host)

Returns the AccessibilityNodeProviderCompat for this helper.

Parameters

          host
          View whose logical children are exposed by this helper.

Returns

The accessibility node provider for this helper.

        public

        int

      getFocusedVirtualView
      ()

Returns the virtual view id for the currently focused item,

Returns

A virtual view id, or INVALID_ID if no item is
         currently focused.

        public

        void

      invalidateRoot
      ()

Notifies the accessibility framework that the properties of the parent
 view have changed.

 You must call this method after adding or removing items from the
 parent view.

        public

        void

      invalidateVirtualView
      (int virtualViewId)

Notifies the accessibility framework that the properties of a particular
 item have changed.

 You must call this method after changing any of the properties set
 in onPopulateNodeForVirtualView(int, AccessibilityNodeInfoCompat).

Parameters

          virtualViewId
          The virtual view id to invalidate.

        public

        boolean

      sendEventForVirtualView
      (int virtualViewId, int eventType)

Populates an event of the specified type with information about an item
 and attempts to send it up through the view hierarchy.

 You should call this method after performing a user action that normally
 fires an accessibility event, such as clicking on an item.

public void performItemClick(T item) {
   ...
   sendEventForVirtualViewId(item.id, AccessibilityEvent.TYPE_VIEW_CLICKED);
 }

Parameters

          virtualViewId
          The virtual view id for which to send an event.

          eventType
          The type of event to send.

Returns

true if the event was sent successfully.

Protected Methods

        protected

        abstract

        int

      getVirtualViewAt
      (float x, float y)

Provides a mapping between view-relative coordinates and logical
 items.

Parameters

          x
          The view-relative x coordinate

          y
          The view-relative y coordinate

Returns

virtual view identifier for the logical item under
         coordinates (x,y)

<A NAME="getVisibleVirtualViews(java.util.List<java.lang.Integer>)">

        protected

        abstract

        void

      getVisibleVirtualViews
      (List<Integer> virtualViewIds)

Populates a list with the view's visible items. The ordering of items
 within virtualViewIds specifies order of accessibility focus
 traversal.

Parameters

          virtualViewIds
          The list to populate with visible items

        protected

        abstract

        boolean

      onPerformActionForVirtualView
      (int virtualViewId, int action, Bundle arguments)

Performs the specified accessibility action on the item associated
 with the virtual view identifier. See
 performAction(int, Bundle) for
 more information.

 Implementations must handle any actions added manually in
 onPopulateNodeForVirtualView(int, AccessibilityNodeInfoCompat).

 The helper class automatically handles focus management resulting
 from ACTION_ACCESSIBILITY_FOCUS
 and
 ACTION_CLEAR_ACCESSIBILITY_FOCUS
 actions.

Parameters

          virtualViewId
          The virtual view identifier of the item on which
            to perform the action

          action
          The accessibility action to perform

          arguments
          (Optional) A bundle with additional arguments, or
            null

Returns

true if the action was performed

        protected

        abstract

        void

      onPopulateEventForVirtualView
      (int virtualViewId, AccessibilityEvent event)

Populates an AccessibilityEvent with information about the
 specified item.

 Implementations must populate the following required fields:

event text, see getText() or
 setContentDescription(CharSequence)

 The helper class automatically populates the following fields with
 default values, but implementations may optionally override them:

item class name, set to android.view.View, see
 setClassName(CharSequence)

 The following required fields are automatically populated by the
 helper class and may not be overridden:

package name, set to the package of the host view's
 Context, see setPackageName(CharSequence)

event source, set to the host view and virtual view identifier,
 see setSource(View, int)

Parameters

          virtualViewId
          The virtual view id for the item for which to
            populate the event

          event
          The event to populate

        protected

        abstract

        void

      onPopulateNodeForVirtualView
      (int virtualViewId, AccessibilityNodeInfoCompat node)

Populates an AccessibilityNodeInfoCompat with information
 about the specified item.

 Implementations must populate the following required fields:

event text, see setText(CharSequence) or
 setContentDescription(CharSequence)

bounds in parent coordinates, see
 setBoundsInParent(Rect)

 The helper class automatically populates the following fields with
 default values, but implementations may optionally override them:

enabled state, set to true, see
 setEnabled(boolean)

item class name, identical to the class name set by
 onPopulateEventForVirtualView(int, AccessibilityEvent), see
 setClassName(CharSequence)

 The following required fields are automatically populated by the
 helper class and may not be overridden:

package name, identical to the package name set by
 onPopulateEventForVirtualView(int, AccessibilityEvent), see
 setPackageName(CharSequence)

node source, identical to the event source set in
 onPopulateEventForVirtualView(int, AccessibilityEvent), see
 setSource(View, int)

parent view, set to the host view, see
 setParent(View)

visibility, computed based on parent-relative bounds, see
 setVisibleToUser(boolean)

accessibility focus, computed based on internal helper state, see
 setAccessibilityFocused(boolean)

bounds in screen coordinates, computed based on host view bounds,
 see setBoundsInScreen(Rect)

 Additionally, the helper class automatically handles accessibility
 focus management by adding the appropriate
 ACTION_ACCESSIBILITY_FOCUS or
 ACTION_CLEAR_ACCESSIBILITY_FOCUS
 action. Implementations must never manually add these actions.

 The helper class also automatically modifies parent- and
 screen-relative bounds to reflect the portion of the item visible
 within its parent.

Parameters

          virtualViewId
          The virtual view identifier of the item for
            which to populate the node

          node
          The node to populate

  Except as noted, this content is licensed under Apache 2.0.
  For details and restrictions, see the
  Content License.

    Android 4.4 r1 —

    About Android  |
    Legal  |
    Support


text:
/*
 * Example file showing a demo with 100 agents split in four groups initially
 * positioned in four corners of the environment. Each agent attempts to move to
 * other side of the environment through a narrow passage generated by four
 * obstacles. There is no roadmap to guide the agents around the obstacles.
 */

#define RVOCS_OUTPUT_TIME_AND_POSITIONS
#define RVOCS_SEED_RANDOM_NUMBER_GENERATOR

using System;
using System.Collections.Generic;

namespace RVO
{
    class Blocks
    {
        /* Store the goals of the agents. */
        readonly IList<Vector2> goals;

        /** Random number generator. */
        readonly Random random;

        Blocks()
        {
            goals = new List<Vector2>();

#if RVOCS_SEED_RANDOM_NUMBER_GENERATOR
            random = new Random();
#else
            random = new Random(0);
#endif
        }

        void setupScenario()
        {
            /* Specify the global time step of the simulation. */
            Simulator.Instance.setTimeStep(0.25f);

            /*
             * Specify the default parameters for agents that are subsequently
             * added.
             */
            Simulator.Instance.setAgentDefaults(15.0f, 10, 5.0f, 5.0f, 2.0f, 2.0f, new Vector2(0.0f, 0.0f));

            /*
             * Add agents, specifying their start position, and store their
             * goals on the opposite side of the environment.
             */
            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 5; ++j)
                {
                    Simulator.Instance.addAgent(new Vector2(55.0f + i * 10.0f, 55.0f + j * 10.0f));
                    goals.Add(new Vector2(-75.0f, -75.0f));

                    Simulator.Instance.addAgent(new Vector2(-55.0f - i * 10.0f, 55.0f + j * 10.0f));
                    goals.Add(new Vector2(75.0f, -75.0f));

                    Simulator.Instance.addAgent(new Vector2(55.0f + i * 10.0f, -55.0f - j * 10.0f));
                    goals.Add(new Vector2(-75.0f, 75.0f));

                    Simulator.Instance.addAgent(new Vector2(-55.0f - i * 10.0f, -55.0f - j * 10.0f));
                    goals.Add(new Vector2(75.0f, 75.0f));
                }
            }

            /*
             * Add (polygonal) obstacles, specifying their vertices in
             * counterclockwise order.
             */
            IList<Vector2> obstacle1 = new List<Vector2>
            {
                new Vector2(-10.0f, 40.0f),
                new Vector2(-40.0f, 40.0f),
                new Vector2(-40.0f, 10.0f),
                new Vector2(-10.0f, 10.0f)
            };
            Simulator.Instance.addObstacle(obstacle1);

            IList<Vector2> obstacle2 = new List<Vector2>
            {
                new Vector2(10.0f, 40.0f),
                new Vector2(10.0f, 10.0f),
                new Vector2(40.0f, 10.0f),
                new Vector2(40.0f, 40.0f)
            };
            Simulator.Instance.addObstacle(obstacle2);

            IList<Vector2> obstacle3 = new List<Vector2>
            {
                new Vector2(10.0f, -40.0f),
                new Vector2(40.0f, -40.0f),
                new Vector2(40.0f, -10.0f),
                new Vector2(10.0f, -10.0f)
            };
            Simulator.Instance.addObstacle(obstacle3);

            IList<Vector2> obstacle4 = new List<Vector2>
            {
                new Vector2(-10.0f, -40.0f),
                new Vector2(-10.0f, -10.0f),
                new Vector2(-40.0f, -10.0f),
                new Vector2(-40.0f, -40.0f)
            };
            Simulator.Instance.addObstacle(obstacle4);

            /*
             * Process the obstacles so that they are accounted for in the
             * simulation.
             */
            Simulator.Instance.processObstacles();
        }

#if RVOCS_OUTPUT_TIME_AND_POSITIONS
        void updateVisualization()
        {
            /* Output the current global time. */
            Console.Write(Simulator.Instance.getGlobalTime());

            /* Output the current position of all the agents. */
            for (int i = 0; i < Simulator.Instance.getNumAgents(); ++i)
            {
                Console.Write(" {0}", Simulator.Instance.getAgentPosition(i));
            }

            Console.WriteLine();
        }
#endif

        void setPreferredVelocities()
        {
            /*
             * Set the preferred velocity to be a vector of unit magnitude
             * (speed) in the direction of the goal.
             */
            for (int i = 0; i < Simulator.Instance.getNumAgents(); ++i)
            {
                Vector2 goalVector = goals[i] - Simulator.Instance.getAgentPosition(i);

                if (RVOMath.absSq(goalVector) > 1.0f)
                {
                    goalVector = RVOMath.normalize(goalVector);
                }

                Simulator.Instance.setAgentPrefVelocity(i, goalVector);

                /* Perturb a little to avoid deadlocks due to perfect symmetry. */
                float angle = (float)random.NextDouble() * 2.0f * (float)Math.PI;
                float dist = (float)random.NextDouble() * 0.0001f;

                Simulator.Instance.setAgentPrefVelocity(i, Simulator.Instance.getAgentPrefVelocity(i) +
                    dist * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)));
            }
        }

        bool reachedGoal()
        {
            /* Check if all agents have reached their goals. */
            for (int i = 0; i < Simulator.Instance.getNumAgents(); ++i)
            {
                if (RVOMath.absSq(Simulator.Instance.getAgentPosition(i) - goals[i]) > 400.0f)
                {
                    return false;
                }
            }

            return true;
        }

        public static void Main(string[] args)
        {
            Blocks blocks = new();

            /* Set up the scenario. */
            blocks.setupScenario();

            /* Perform (and manipulate) the simulation. */
            do
            {
#if RVOCS_OUTPUT_TIME_AND_POSITIONS
                blocks.updateVisualization();
#endif
                blocks.setPreferredVelocities();
                Simulator.Instance.doStep();
            }
            while (!blocks.reachedGoal());
        }
    }
}


text:
package org.springframework.richclient.command.support;

import org.springframework.richclient.widget.Widget;
import org.springframework.richclient.widget.editor.AbstractDataEditorWidget;
import org.springframework.richclient.widget.editor.DefaultDataEditorWidget;
import org.springframework.util.Assert;

import java.util.Map;

/**
 * Widget command om een DefaultDataEditorWidget te tonen (of een widget
 * die daarvan extend)
 *
 * @author ldo
 * @since 0.4.4
 */
public class DataEditorWidgetViewCommand extends WidgetViewCommand
{
    /**
     * {@inheritDoc}
     *
     * Open de dataeditor.
     */
    protected void doExecuteCommand()
    {
        Widget widget = super.getWidget();
        Assert.isInstanceOf(AbstractDataEditorWidget.class, widget);
        AbstractDataEditorWidget dataEditorWidget = (AbstractDataEditorWidget)widget;
        Object dataEditorParameters = getParameter(DefaultDataEditorWidget.PARAMETER_MAP);
        if(dataEditorParameters != null)
        {
            dataEditorWidget.executeFilter((Map<String, Object>)dataEditorParameters);
        }

        super.doExecuteCommand();
    }
}


text:
module Odiseo::GeneralBalanceReportsHelper
end


text:
@implementation PKTImageDownloader

+ (PKTAsyncTask *)setImageWithFile:(PKTFile *)file placeholderImage:(UIImage *)placeholderImage imageSize:(PKTImageSize)imageSize imageSetterBlock:(void (^)(UIImage *image))imageSetterBlock {
  NSParameterAssert(file);
  NSParameterAssert(imageSetterBlock);

  // Check for a cached image
  UIImage *image = [[PKTImageCache sharedCache] cachedImageForFile:file];
  if (image) {
    imageSetterBlock(image);
    return nil;
  }

  imageSetterBlock(placeholderImage);

  PKTAsyncTask *task = [[file downloadImageOfSize:imageSize] then:^(UIImage *image, NSError *error) {
    if (image) {
      [[PKTImageCache sharedCache] setCachedImage:image forFile:file];
      imageSetterBlock(image);
    }
  }];

  return task;
}

@end


text:
package x10;

/** OperationTimedOutException is an exception to be thrown when an operation times out.
  *
  *
  * @author Wade Wassenberg
  *
  * @version 1.0
  */

public class OperationTimedOutException extends Exception
{

    /** OperationTimedOutException constructs an OperationTimedOutException with no message
      *
      *
      */

    public OperationTimedOutException()
    {
        super();
    }

    /** OperationTimedOutException constructs an OperationTimedOutException with the specified message
      *
      * @param message the error message associated to the exception.
      *
      */

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


text:
package org.grain.httpserver;

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

public class HeadParam {
	// 操作码
	public String hOpCode;
	// 身份
	public String token;
	// 请求唯一id
	public String fileUuid;
	// 消息包
	public String packet;
	// 头消息map
	public Map<String, String> headParam = new HashMap<>();
	// param与from解析出来的参数
	public Map<String, String> parameterParam = new HashMap<>();

	public HeadParam() {

	}

	public void clear() {
		headParam.clear();
		headParam = null;
		parameterParam.clear();
		parameterParam = null;
	}
}


text:
using System;
using System.Diagnostics;
using System.Globalization;

namespace SaltEdge.Utils
{
    public class SEDateTools
    {
        public static DateTime parseStringToDate(string date)
        {
            try
            {
                return DateTime.Parse(date);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.StackTrace);
            }
            return new DateTime();
        }

        public static DateTime parseShortStringToDate(string date)
        {
            try
            {
                return DateTime.ParseExact(date, "yyyy-MM-dd", CultureInfo.CurrentCulture);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
                Debug.WriteLine(e.StackTrace);
            }
            return new DateTime();
        }

        public static string parseDateToShortString(DateTime date)
        {
            return date.ToString("yyyy-MM-dd");
        }
    }
}


text:
package org.jboss.pnc.bpm;

import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.jboss.pnc.bpm.task.BpmBuildTask;
import org.jboss.pnc.common.Configuration;
import org.jboss.pnc.common.json.ConfigurationParseException;
import org.jboss.pnc.common.json.moduleconfig.BpmModuleConfig;
import org.jboss.pnc.common.json.moduleprovider.PncConfigProvider;
import org.jboss.pnc.common.util.StringUtils;
import org.jboss.pnc.rest.restmodel.bpm.BpmNotificationRest;
import org.jboss.pnc.spi.exception.CoreException;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.api.runtime.process.ProcessInstance;
import org.kie.services.client.api.RemoteRuntimeEngineFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static java.lang.Integer.MAX_VALUE;
import static org.jboss.pnc.bpm.BpmEventType.nullableValueOf;
import static org.kie.api.runtime.process.ProcessInstance.STATE_ABORTED;
import static org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED;

/**
 * Responsible for starting, keeping track of, and notifying BPM tasks.
 * Thread safe.
 *
 * @author Jakub Senko
 */
@ApplicationScoped
public class BpmManager {

    private static final Logger log = LoggerFactory.getLogger(BpmManager.class);

    private static final int AUTHENTICATION_TIMEOUT_S = 2 * 60;

    private Configuration configuration;
    private BpmModuleConfig bpmConfig;
    private AtomicInteger nextTaskId = new AtomicInteger(1);
    private Map<Integer, BpmTask> tasks = new ConcurrentHashMap<>();
    private KieSession session;

    private static final String SIGNAL_CANCEL = "CANCELLED";

    private Set<Consumer<BpmTask>> newTaskAddedSubscribes = new HashSet<>();

    @Deprecated
    public BpmManager() { //CDI workaround
    }

    @Inject
    public BpmManager(Configuration configuration) {
        this.configuration = configuration;
    }

    @PostConstruct
    public void init() throws CoreException {
        try {
            bpmConfig = configuration.getModuleConfig(new PncConfigProvider<>(BpmModuleConfig.class));
        } catch (ConfigurationParseException e) {
            throw new CoreException("BPM manager could not get its configuration.", e);
        }
        session = initKieSession();
    }

    protected KieSession initKieSession() throws CoreException {
        RuntimeEngine restSessionFactory;
        try {
            restSessionFactory = RemoteRuntimeEngineFactory.newRestBuilder()
                    .addDeploymentId(bpmConfig.getDeploymentId())
                    .addUrl(new URL(bpmConfig.getBpmInstanceUrl()))
                    .addUserName(bpmConfig.getUsername())
                    .addPassword(bpmConfig.getPassword())
                    .addTimeout(AUTHENTICATION_TIMEOUT_S)
                    .build();
        } catch (Exception e) {
            throw new CoreException("Could not initialize connection to BPM server at '" +
                    bpmConfig.getBpmInstanceUrl() + "' check that the URL is correct.", e);
        }

        return restSessionFactory.getKieSession();
    }

    @PreDestroy
    private void dispose() {
        session.dispose();
    }

    private int getNextTaskId() {
        return nextTaskId.getAndIncrement();
    }

    public boolean startTask(BpmTask task) throws CoreException {
        try {
            task.setTaskId(getNextTaskId());
            task.setBpmConfig(bpmConfig);

            ProcessInstance processInstance = session.startProcess(task.getProcessId(),
                    task.getExtendedProcessParameters());
            if (processInstance == null) {
                log.warn("Failed to create new process instance.");
                return false;
            }

            task.setProcessInstanceId(processInstance.getId());
            task.setProcessName(processInstance.getProcessId());
            tasks.put(task.getTaskId(), task);

            log.debug("Notifying new task added {}.", task.getTaskId());
            notifyNewTaskAdded(task);

            log.debug("Created new process linked to task: {}", task);
            return true;

        } catch (Exception e) {
            throw new CoreException("Could not start BPM task '" + task + "'.", e);
        }
    }

    private void notifyNewTaskAdded(BpmTask task) {
        log.debug("Notifying {} subscribers for new task {}.", newTaskAddedSubscribes.size(), task.getTaskId());
        newTaskAddedSubscribes.forEach(subscriber -> {
            log.debug("Notifying subscriber {}.", subscriber.getClass());
            subscriber.accept(task);
        });
    }

    public boolean subscribeToNewTasks(Consumer<BpmTask> consumer) {
        log.debug("Subscribing new tasks consumer {}.", consumer);
        return newTaskAddedSubscribes.add(consumer);
    }

    public boolean unSubscribeFromNewTasks(Consumer<BpmTask> consumer) {
        return newTaskAddedSubscribes.remove(consumer);
    }

    public boolean cancelTask(BpmTask bpmTask) {
        String cancelEndpointUrl = StringUtils.stripEndingSlash(bpmConfig.getBpmInstanceUrl()) + "/nclcancelhandler";

        URI uri;
        try {
            URIBuilder uriBuilder = new URIBuilder(cancelEndpointUrl);
            uriBuilder.addParameter("processInstanceId", bpmTask.getProcessInstanceId().toString());
            uri = uriBuilder.build();
        } catch (URISyntaxException e) {
            log.error("Unable to cancel process id: " + bpmTask.getProcessId(), e);
            return false;
        }

        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
            log.debug("Triggering the cancellation using url: {}", uri.toString());
            HttpGet httpget = new HttpGet(uri);
            httpget.setConfig(RequestConfig.custom()
                    .setConnectionRequestTimeout(bpmConfig.getCancelConnectionRequestTimeout())
                    .setConnectTimeout(bpmConfig.getCancelConnectTimeout())
                    .setSocketTimeout(bpmConfig.getCancelSocketTimeout())
                    .build());
            CloseableHttpResponse httpResponse = httpClient.execute(httpget);
            int statusCode = httpResponse.getStatusLine().getStatusCode();
            httpResponse.close();
            log.info("Cancel request for bpmTask.id: {} and processInstanceId: {} completed with status: {}.",
                    bpmTask.getTaskId(), bpmTask.getProcessInstanceId(), statusCode);
            return statusCode == 200;
        } catch (IOException e) {
            log.error("Unable to cancel process id: " + bpmTask.getProcessId(), e);
            return false;
        }
    }

    public void notify(int taskId, BpmNotificationRest notification) { //TODO do not use RestModel down here.
        log.debug("Will process notification for taskId: {}; BpmNotificationRest: {}.", taskId, notification.toString());
        Optional<BpmTask> maybeTask = getTaskById(taskId);
        if (!maybeTask.isPresent()) {
            log.error("Cannot notify tasks with id: [{}]. Ids of tasks in progress: {}", taskId, tasks.keySet());
        }
        maybeTask.ifPresent(task -> {
            BpmEventType bpmEventType = nullableValueOf(notification.getEventType());
            if (bpmEventType != null && bpmEventType.getType().isInstance(notification)) {
                log.debug("Notifying task: {}, eventType: {}, notification: {}.", task.getTaskId(), bpmEventType, notification.toString());
                task.notify(bpmEventType, notification);
            }
        });

        log.info("finished notifying for taskId: {}", taskId);
    }

    /**
     * Regularly cleans finished BPM tasks asynchronously
     * Immediate cleanup is not usable because of NCL-2300
     */
    public void cleanup() { //TODO remove tasks immediately after the completion, see: BuildTaskEndpoint.buildTaskCompleted
        log.debug("Bpm manager tasks cleanup started");

        if (session == null) {
            log.error("Kie session not available.");
        }

        Map<Integer, BpmTask> clonedTaskMap = new HashMap<>(this.tasks);

        Set<Integer> toBeRemoved = clonedTaskMap.values().stream()
                .filter(bpmTask -> {
                    if (bpmTask == null) {
                        log.warn("Listing invalid entry for removal from the tasks list.");
                        return true;
                    }
                    log.debug("Attempting to fetch process instance for bpmTask: {}.", bpmTask.getTaskId());
                    Long processInstanceId = bpmTask.getProcessInstanceId();
                    ProcessInstance processInstance = session.getProcessInstance(processInstanceId);
                    log.debug("fetched: {}", processInstance);
                    if (processInstance == null) // instance has been terminated from outside
                        return true;
                    int state = processInstance.getState();
                    return state == STATE_COMPLETED || state == STATE_ABORTED;
                })
                .map(BpmTask::getTaskId)
                .collect(Collectors.toSet());
        toBeRemoved.forEach(id -> {
            BpmTask removed = tasks.remove(id);
            if (removed != null) {
                log.debug("Removed bpmTask.id: {}.", removed.getTaskId());
            } else {
                log.warn("Unable to remove bpmTask.id: {}.", id);
            }
        });

        log.debug("Bpm manager tasks cleanup finished");
    }

    /**
     * This method solves backwards compatibility problem.
     * It will be removed soon.
     */
    @Deprecated
    public Integer getTaskIdByBuildId(int buildId) {
        List<Integer> result = tasks.values().stream()
                .filter(t -> t instanceof BpmBuildTask)
                .filter(t -> ((BpmBuildTask) t).getBuildTask().getId() == buildId)
                .map(BpmTask::getTaskId)
                .collect(Collectors.toList());
        if (result.size() > 1)
            throw new IllegalStateException("More that one task with the same build id: " + result);
        return result.size() == 1 ? result.get(0) : null;
    }

    public Collection<BpmTask> getActiveTasks() {
        return Collections.unmodifiableCollection(new HashSet<>(tasks.values()));
    }

    public Optional<BpmTask> getTaskById(int taskId) {
        return Optional.ofNullable(tasks.get(taskId));
    }
}