text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-792
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.11.15 at 07:01:26 PM IRST
//

package org.cloudface.tosca.model;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;

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

 * <complexType name="tRelationshipType">
 *   <complexContent>
 *     <extension base="{http://docs.oasis-open.org/tosca/ns/2011/12}tEntityType">
 *       <sequence>
 *         <element name="InstanceStates" type="{http://docs.oasis-open.org/tosca/ns/2011/12}tTopologyElementInstanceStates" minOccurs="0"/>
 *         <element name="SourceInterfaces" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="Interface" type="{http://docs.oasis-open.org/tosca/ns/2011/12}tInterface" maxOccurs="unbounded"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="TargetInterfaces" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <sequence>
 *                   <element name="Interface" type="{http://docs.oasis-open.org/tosca/ns/2011/12}tInterface" maxOccurs="unbounded"/>
 *                 </sequence>
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="ValidSource" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="typeRef" use="required" type="{http://www.w3.org/2001/XMLSchema}QName" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *         <element name="ValidTarget" minOccurs="0">
 *           <complexType>
 *             <complexContent>
 *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *                 <attribute name="typeRef" use="required" type="{http://www.w3.org/2001/XMLSchema}QName" />
 *               </restriction>
 *             </complexContent>
 *           </complexType>
 *         </element>
 *       </sequence>
 *       <anyAttribute processContents='lax' namespace='##other'/>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tRelationshipType", propOrder = {
    "instanceStates",
    "sourceInterfaces",
    "targetInterfaces",
    "validSource",
    "validTarget"
})
public class TRelationshipType
    extends TEntityType
{

    @XmlElement(name = "InstanceStates")
    protected TTopologyElementInstanceStates instanceStates;
    @XmlElement(name = "SourceInterfaces")
    protected TRelationshipType.SourceInterfaces sourceInterfaces;
    @XmlElement(name = "TargetInterfaces")
    protected TRelationshipType.TargetInterfaces targetInterfaces;
    @XmlElement(name = "ValidSource")
    protected TRelationshipType.ValidSource validSource;
    @XmlElement(name = "ValidTarget")
    protected TRelationshipType.ValidTarget validTarget;

    /**
     * Gets the value of the instanceStates property.
     *
     * @return
     *     possible object is
     *     {@link TTopologyElementInstanceStates }
     *
     */
    public TTopologyElementInstanceStates getInstanceStates() {
        return instanceStates;
    }

    /**
     * Sets the value of the instanceStates property.
     *
     * @param value
     *     allowed object is
     *     {@link TTopologyElementInstanceStates }
     *
     */
    public void setInstanceStates(TTopologyElementInstanceStates value) {
        this.instanceStates = value;
    }

    /**
     * Gets the value of the sourceInterfaces property.
     *
     * @return
     *     possible object is
     *     {@link TRelationshipType.SourceInterfaces }
     *
     */
    public TRelationshipType.SourceInterfaces getSourceInterfaces() {
        return sourceInterfaces;
    }

    /**
     * Sets the value of the sourceInterfaces property.
     *
     * @param value
     *     allowed object is
     *     {@link TRelationshipType.SourceInterfaces }
     *
     */
    public void setSourceInterfaces(TRelationshipType.SourceInterfaces value) {
        this.sourceInterfaces = value;
    }

    /**
     * Gets the value of the targetInterfaces property.
     *
     * @return
     *     possible object is
     *     {@link TRelationshipType.TargetInterfaces }
     *
     */
    public TRelationshipType.TargetInterfaces getTargetInterfaces() {
        return targetInterfaces;
    }

    /**
     * Sets the value of the targetInterfaces property.
     *
     * @param value
     *     allowed object is
     *     {@link TRelationshipType.TargetInterfaces }
     *
     */
    public void setTargetInterfaces(TRelationshipType.TargetInterfaces value) {
        this.targetInterfaces = value;
    }

    /**
     * Gets the value of the validSource property.
     *
     * @return
     *     possible object is
     *     {@link TRelationshipType.ValidSource }
     *
     */
    public TRelationshipType.ValidSource getValidSource() {
        return validSource;
    }

    /**
     * Sets the value of the validSource property.
     *
     * @param value
     *     allowed object is
     *     {@link TRelationshipType.ValidSource }
     *
     */
    public void setValidSource(TRelationshipType.ValidSource value) {
        this.validSource = value;
    }

    /**
     * Gets the value of the validTarget property.
     *
     * @return
     *     possible object is
     *     {@link TRelationshipType.ValidTarget }
     *
     */
    public TRelationshipType.ValidTarget getValidTarget() {
        return validTarget;
    }

    /**
     * Sets the value of the validTarget property.
     *
     * @param value
     *     allowed object is
     *     {@link TRelationshipType.ValidTarget }
     *
     */
    public void setValidTarget(TRelationshipType.ValidTarget value) {
        this.validTarget = value;
    }

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

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="Interface" type="{http://docs.oasis-open.org/tosca/ns/2011/12}tInterface" maxOccurs="unbounded"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "_interface"
    })
    public static class SourceInterfaces {

        @XmlElement(name = "Interface", required = true)
        protected List<TInterface> _interface;

        /**
         * Gets the value of the interface property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the interface property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getInterface().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link TInterface }
         *
         *
         */
        public List<TInterface> getInterface() {
            if (_interface == null) {
                _interface = new ArrayList<TInterface>();
            }
            return this._interface;
        }

    }

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

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="Interface" type="{http://docs.oasis-open.org/tosca/ns/2011/12}tInterface" maxOccurs="unbounded"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "", propOrder = {
        "_interface"
    })
    public static class TargetInterfaces {

        @XmlElement(name = "Interface", required = true)
        protected List<TInterface> _interface;

        /**
         * Gets the value of the interface property.
         *
         *

         * This accessor method returns a reference to the live list,
         * not a snapshot. Therefore any modification you make to the
         * returned list will be present inside the JAXB object.
         * This is why there is not a set method for the interface property.
         *
         *

         * For example, to add a new item, do as follows:
         *

         *    getInterface().add(newItem);
         *

         *
         *
         *

         * Objects of the following type(s) are allowed in the list
         * {@link TInterface }
         *
         *
         */
        public List<TInterface> getInterface() {
            if (_interface == null) {
                _interface = new ArrayList<TInterface>();
            }
            return this._interface;
        }

    }

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

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="typeRef" use="required" type="{http://www.w3.org/2001/XMLSchema}QName" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class ValidSource {

        @XmlAttribute(required = true)
        protected QName typeRef;

        /**
         * Gets the value of the typeRef property.
         *
         * @return
         *     possible object is
         *     {@link QName }
         *
         */
        public QName getTypeRef() {
            return typeRef;
        }

        /**
         * Sets the value of the typeRef property.
         *
         * @param value
         *     allowed object is
         *     {@link QName }
         *
         */
        public void setTypeRef(QName value) {
            this.typeRef = value;
        }

    }

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

     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <attribute name="typeRef" use="required" type="{http://www.w3.org/2001/XMLSchema}QName" />
     *     </restriction>
     *   </complexContent>
     * </complexType>
     *

     *
     *
     */
    @XmlAccessorType(XmlAccessType.FIELD)
    @XmlType(name = "")
    public static class ValidTarget {

        @XmlAttribute(required = true)
        protected QName typeRef;

        /**
         * Gets the value of the typeRef property.
         *
         * @return
         *     possible object is
         *     {@link QName }
         *
         */
        public QName getTypeRef() {
            return typeRef;
        }

        /**
         * Sets the value of the typeRef property.
         *
         * @param value
         *     allowed object is
         *     {@link QName }
         *
         */
        public void setTypeRef(QName value) {
            this.typeRef = value;
        }

    }

}


text:
<?php

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/* LANGUAGE */

$avchat_language[0] = 'Start an audio/video call';
$avchat_language[1] = 'Please wait atleast 10 seconds before trying to call again.';
$avchat_language[2] = 'has sent you an audio/video chat request.';
$avchat_language[3] = 'Click here to accept it';
$avchat_language[4] = 'or simply ignore this message.';
$avchat_language[5] = 'has successfully sent an audio/video chat request.';
$avchat_language[6] = 'has accepted your audio/video chat request.';
$avchat_language[7] = 'Click here to launch the AV window';
$avchat_language[8] = 'Audio/Video Chat';
$avchat_language[9] = 'Having issues connecting?';
$avchat_language[10] = 'There are several reasons why the audio/video chat may be stuck at initializing:

1. Audio/video chat requires P2P to establish connection. In order for it to work, your firewall must be configured to allow outgoing UDP traffic. While this is the case with most consumer or small office/home office (SOHO) firewalls, many corporate firewalls block UDP traffic altogether.

2. The user at the other end is behind a UDP blocking firewall and is unable to connect to you.

3. Our servers are facing issues and you are unable to connect.
';
$avchat_language[11] = 'Closing window shortly';
$avchat_language[12] = 'Users have been successfully invited. You can safely close this window.';
$avchat_language[13] = 'Users Invited Successfully!';
$avchat_language[14] = 'has invited you to join a video conference. ';
$avchat_language[15] = 'Click here to join';
$avchat_language[16] = 'Please select users';
$avchat_language[17] = 'Invite Users';
$avchat_language[18] = 'Invite Users';
$avchat_language[19] = 'has started a video conversation.';
$avchat_language[20] = 'Click here to join the conversation.';
$avchat_language[21] = 'Settings';
$avchat_language[22] = 'Done';
$avchat_language[23] = 'Play test sound';
$avchat_language[24] = 'Install plug-in';
$avchat_language[25] = 'Sorry, there are no users available at the moment to invite.';
$avchat_language[26] = 'Click here to open it';
$avchat_language[27] = 'Please check your email for verification zoom account at';
$avchat_language[28] = 'Call';
$avchat_language[29] = 'Call from';
$avchat_language[30] = 'Call to';
$avchat_language[31] = 'Call ended, duration';
$avchat_language[32] = 'rejected';
$avchat_language[33] = 'No answer from';
$avchat_language[34] = 'Cancelled';
$avchat_language[35] = 'Would you like to call';
$avchat_language[36] = 'busy';
$avchat_language[37] = 'This call has been cancelled.';
$avchat_language[38] = 'This call has ended.';
$avchat_language[39] = 'The user is busy right now. Please try again later';
$avchat_language[40] = 'The user is not answering the call right now. Please try again later.';
$avchat_language[41] = 'Sorry, we are unable to send this message.';
$avchat_language[42] = 'Sorry, your device does not support this feature.';
$avchat_language[43] = 'click here';
$avchat_language[44] = 'To cancel outgoing call ';
$avchat_language[45] = 'To reject call ';
$avchat_language[46] = '';
$avchat_language[47] = 'Please configure this plugin using administration panel before using. Click Here for more information.';
$avchat_language[48] = 'Sorry, this feature is currently supported in Chrome, Firefox and Opera browser.';
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

redpajama_set_name: RedPajamaGithub


text:
<!doctype html>

    <title>Code coverage report for ol/geom/flat/segmentsflatgeom.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../../prettify.css" />
    <link rel="stylesheet" href="../../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      all files / ol/geom/flat/ segmentsflatgeom.js

        100%
        Statements
        14/14

        100%
        Branches
        2/2

        100%
        Functions
        1/1

        100%
        Lines
        14/14

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35	1×

1×
32×
32×
32×
32×
53×
53×
53×
53×
13×

40×
40×

19×

goog.provide('ol.geom.flat.segments');

/**
 * This function calls `callback` for each segment of the flat coordinates
 * array. If the callback returns a truthy value the function returns that
 * value immediately. Otherwise the function returns `false`.
 * @param {Array.<number>} flatCoordinates Flat coordinates.
 * @param {number} offset Offset.
 * @param {number} end End.
 * @param {number} stride Stride.
 * @param {function(this: S, ol.Coordinate, ol.Coordinate): T} callback Function
 *     called for each segment.
 * @param {S=} opt_this The object to be used as the value of 'this'
 *     within callback.
 * @return {T|boolean} Value.
 * @template T,S
 */
ol.geom.flat.segments.forEach = function(flatCoordinates, offset, end, stride, callback, opt_this) {
  var point1 = [flatCoordinates[offset], flatCoordinates[offset + 1]];
  var point2 = [];
  var ret;
  for (; (offset + stride) < end; offset += stride) {
    point2[0] = flatCoordinates[offset + stride];
    point2[1] = flatCoordinates[offset + stride + 1];
    ret = callback.call(opt_this, point1, point2);
    if (ret) {
      return ret;
    }
    point1[0] = point2[0];
    point1[1] = point2[1];
  }
  return false;
};

  Code coverage
  generated by istanbul at Fri Mar 11 2016 13:34:39 GMT+0100 (CET)


text:
/* ###
 * IP: LGPL 2.1
 * NOTE: See binutils/libiberty/COPYING.LIB
 */
/* Internal demangler interface for the Rust programming language.
   Copyright (C) 2016-2019 Free Software Foundation, Inc.
   Written by David Tolnay (dtolnay@gmail.com).

This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

In addition to the permissions in the GNU Library General Public
License, the Free Software Foundation gives you unlimited permission
to link the compiled version of this file into combinations with other
programs, and to distribute those combinations without any restriction
coming from the use of this file.  (The Library Public License
restrictions do apply in other respects; for example, they cover
modification of the file, and distribution when not linked into a
combined executable.)

Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/>.  */

/* This file provides some definitions shared by cplus-dem.c and
   rust-demangle.c.  It should not be included by any other files.  */

/* Returns non-zero iff MANGLED is a rust mangled symbol.  MANGLED must
   already have been demangled through cplus_demangle_v3.  If this function
   returns non-zero then MANGLED can be demangled (in-place) using
   RUST_DEMANGLE_SYM.  */
extern int
rust_is_mangled (const char *mangled);

/* Demangles SYM (in-place) if RUST_IS_MANGLED returned non-zero for SYM.
   If RUST_IS_MANGLED returned zero for SYM then RUST_DEMANGLE_SYM might
   replace characters that cannot be demangled with '?' and might truncate
   SYM.  After calling RUST_DEMANGLE_SYM SYM might be shorter, but never
   larger.  */
extern void
rust_demangle_sym (char *sym);


text:
export STATUS_OK=200
export STATUS_DELETE_SUCCESS='200|204'
export STATUS_PATCH_SUCCESS='200|201|204'
# export POST_SUCCESS='200|201|204'
export STATUS_POST_SUCCESS='200|201|204'
# export PUT_SUCCESS='201|204'
# export STATUS_PUT_SUCCESS='200|201|204'
export STATUS_CREATED=201
export STATUS_NO_CONTENT=204
export STATUS_UPDATED='201|204'
# export DELETE_SUCCESS=204
export STATUS_NOT_MODIFIED=304
export STATUS_BAD_REQUEST=400
export STATUS_UNAUTHORIZED=401
export STATUS_NOT_FOUND=404
export STATUS_NOT_ACCEPTABLE=406
export STATUS_UNSUPPORTED_MEDIA=415
export STATUS_INTERNAL_SERVER_ERROR=500
export STATUS_NOT_IMPLEMENTED=501

function run_tests()
{
    local error_count=0
    for script_pathname in "$@"
    do
        echo -n "$script_pathname";
        script_filename=$(basename "$script_pathname")
        script_directory=$(dirname "$script_pathname")
        ( cd "$script_directory" || exit;
            bash -e "$script_filename";
        )
        if [[ $? == "0" ]]
        then
            echo "   ok"
        else
            echo "   failed";
            (( error_count += 1))
        fi
    done
    return $error_count
}

function initialize_dataset()
{
    echo "@base <${1}> ." \
    | cat - "${2}" \
    | curl -f -s \
      -X PUT \
      --data-binary @- \
      -H "Content-Type: application/trig" \
      "${3}data" > /dev/null
}

export -f initialize_dataset

export ENDPOINT_URL="http://localhost:3030/ds/"
export ENDPOINT_URL_WRITABLE="http://localhost:3031/ds/"

error_count=0

### Core Templates ontology tests ###

export BASE_URL="http://localhost:8080/"
export BASE_URL_WRITABLE="http://localhost:8081/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n ### Core Templates ontology tests ###\n\n"

run_tests $(find ./linked-data-templates/ct/ -type f -name '*.sh*')
(( error_count += $? ))

### Named Graph Templates ontology tests ###

export BASE_URL="http://localhost:8082/"
export BASE_URL_WRITABLE="http://localhost:8083/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### Named Graph Templates ontology tests ###\n\n"

run_tests $(find ./linked-data-templates/ngt/ -type f -name '*.sh*')
(( error_count += $? ))

### Custom LDT ontology tests ###

export BASE_URL="http://localhost:8084/"
export BASE_URL_WRITABLE="http://localhost:8085/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### Custom LDT ontology tests ###\n\n"

run_tests $(find ./linked-data-templates/custom/ -type f -name '*.sh*')
(( error_count += $? ))

### SPARQL Protocol query tests ###

export BASE_URL="http://localhost:8080/"
export BASE_URL_WRITABLE="http://localhost:8081/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### SPARQL Protocol query tests ###\n\n"

run_tests $(find ./sparql-protocol/query/ -type f -name '*.sh*')
(( error_count += $? ))

### SPARQL Protocol update tests ###

export BASE_URL="http://localhost:8080/"
export BASE_URL_WRITABLE="http://localhost:8081/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### SPARQL Protocol update tests ###\n\n"

run_tests $(find ./sparql-protocol/update/ -type f -name '*.sh*')
(( error_count += $? ))

### Graph Store Protocol tests ###

export BASE_URL="http://localhost:8080/"
export BASE_URL_WRITABLE="http://localhost:8081/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### Graph Store Protocol tests ###\n\n"

run_tests $(find ./graph-store-protocol/ -maxdepth 1 -type f -name '*.sh*')
(( error_count += $? ))

# use custom ontology with GraphItem template for direct identification tests

export BASE_URL="http://localhost:8084/"
export BASE_URL_WRITABLE="http://localhost:8085/"

initialize_dataset "$BASE_URL" "dataset.trig" "$ENDPOINT_URL"
initialize_dataset "$BASE_URL_WRITABLE" "dataset.trig" "$ENDPOINT_URL_WRITABLE"

printf "\n### Graph Store Protocol (direct identification) tests ###\n\n"

run_tests $(find ./graph-store-protocol/direct/ -type f -name '*.sh*')
(( error_count += $? ))

### Exit

exit $error_count


text:
@interface ScribbleVC ()

@property (nonatomic) BOOL lineColorPickerSelected;
@property (nonatomic, weak) IBOutlet UIButton *clearButton;
@property (nonatomic, weak) IBOutlet UIButton *lineColorPickerButton;
@property (nonatomic, weak) IBOutlet UIButton *bgColorPickerButton;
@property (nonatomic, weak) IBOutlet HRColorPickerView *colorPickerView;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *colorPickerLeftConstraint;
@property (nonatomic, weak) IBOutlet NSLayoutConstraint *colorPickerTopConstraint;

@end

@implementation ScribbleVC

-(void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"Scribble!";
    self.navigationItem.leftBarButtonItem = self.cancelButton;
    self.navigationItem.rightBarButtonItem = self.acceptButton;
    [self.colorPickerView addTarget:self
                             action:@selector(colorPickerViewValueChanged:)
                   forControlEvents:UIControlEventValueChanged];
    [self.colorPickerView setColor:[UIColor redColor]];
}

-(IBAction)colorPickerButtonClicked:(id)sender
{
    self.lineColorPickerSelected = (sender == self.lineColorPickerButton);
    self.colorPickerView.hidden = !self.colorPickerView.hidden;
    self.acceptButton.enabled = self.colorPickerView.hidden;
    self.cancelButton.enabled = self.colorPickerView.hidden;
    self.clearButton.enabled = self.colorPickerView.hidden;
    self.pasteButton.enabled = self.colorPickerView.hidden;
}

-(IBAction)barButtonItemClicked:(id)sender
{
    if (sender == self.cancelButton)
    {
        if ([self.scribbleDelegate respondsToSelector:@selector(scribbleVCDismissed:)])
            [self.scribbleDelegate scribbleVCDismissed:self];
        else
            [self dismissViewControllerAnimated:YES completion:nil];
    } else if (sender == self.acceptButton)
    {
		if ([self.scribbleDelegate respondsToSelector:@selector(scribbleVCAccepted:withStrokes:)])
			[self.scribbleDelegate scribbleVCAccepted:self withStrokes:self.canvasView.strokeData];
    }
}

-(IBAction)clearButtonClicked
{
    [self.canvasView clear];
    if ([self.scribbleDelegate respondsToSelector:@selector(scribbleVCCleared:)])
        [self.scribbleDelegate scribbleVCCleared:self];
}

-(IBAction)pasteButtonClicked
{
    NSLog(@"Paste not yet implemented");
}

-(IBAction)colorPickerViewValueChanged:(id)sender
{
    if (self.lineColorPickerSelected)
    {
        self.lineColorPickerButton.backgroundColor = self.colorPickerView.color;
        [self.canvasView startNewStrokeWithColor:self.colorPickerView.color withWidth:-1];
    }
    else
    {
        self.bgColorPickerButton.backgroundColor = self.colorPickerView.color;
        self.canvasView.backgroundColor = self.colorPickerView.color;
    }
}

#pragma CanvasViewDelegate methods

-(void)canvasView:(CanvasView *)canvasView startedAnimationLoop:(NSInteger)loopIndex resumed:(BOOL)resumed
{
    self.clearButton.enabled = NO;
    self.pasteButton.enabled = NO;
    self.lineColorPickerButton.enabled = NO;
    self.bgColorPickerButton.enabled = NO;
}

-(void)canvasViewAnimationStopped:(CanvasView *)canvasView
{
    self.clearButton.enabled = YES;
    self.pasteButton.enabled = YES;
    self.lineColorPickerButton.enabled = YES;
    self.bgColorPickerButton.enabled = YES;
}

@end


text:
package com.box.castle.core.worker

import akka.actor.ActorRef
import com.box.castle.common.TypedActorRef

case class WorkerActorRef(ref: ActorRef) extends TypedActorRef


text:
package org.apache.zookeeper.server;

import java.io.PrintWriter;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.Map.Entry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;

/**
 * This class manages watches. It allows watches to be associated with a string
 * and removes watchers and their watches in addition to managing triggers.
 */
public class WatchManager {
    private static final Logger LOG = LoggerFactory.getLogger(WatchManager.class);

    //从数据节点的粒度来托管Watcher
    private final HashMap<String, HashSet<Watcher>> watchTable =
        new HashMap<String, HashSet<Watcher>>();
    //从Watcher的粒度来控制事件触发需要触发的数据节点
    private final HashMap<Watcher, HashSet<String>> watch2Paths =
        new HashMap<Watcher, HashSet<String>>();

    public synchronized int size(){
        int result = 0;
        for(Set<Watcher> watches : watchTable.values()) {
            result += watches.size();
        }
        return result;
    }

    /**
     * 对watchTable与watch2Paths添加watcher
     * @param path
     * @param watcher
     */
    public synchronized void addWatch(String path, Watcher watcher) {
        HashSet<Watcher> list = watchTable.get(path);
        if (list == null) {
            // don't waste memory if there are few watches on a node
            // rehash when the 4th entry is added, doubling size thereafter
            // seems like a good compromise
            list = new HashSet<Watcher>(4);
            watchTable.put(path, list);
        }
        list.add(watcher);

        HashSet<String> paths = watch2Paths.get(watcher);
        if (paths == null) {
            // cnxns typically have many watches, so use default cap here
            paths = new HashSet<String>();
            watch2Paths.put(watcher, paths);
        }
        paths.add(path);
    }

    public synchronized void removeWatcher(Watcher watcher) {
        HashSet<String> paths = watch2Paths.remove(watcher);
        if (paths == null) {
            return;
        }
        for (String p : paths) {
            HashSet<Watcher> list = watchTable.get(p);
            if (list != null) {
                list.remove(watcher);
                if (list.size() == 0) {
                    watchTable.remove(p);
                }
            }
        }
    }

    public Set<Watcher> triggerWatch(String path, EventType type) {
        return triggerWatch(path, type, null);
    }

    //
    public Set<Watcher> triggerWatch(String path, EventType type, Set<Watcher> supress) {
        WatchedEvent e = new WatchedEvent(type,
                KeeperState.SyncConnected, path);
        HashSet<Watcher> watchers;
        synchronized (this) {
        	//从watchTable中remove当前事件的watcher
            watchers = watchTable.remove(path);
            if (watchers == null || watchers.isEmpty()) {
                if (LOG.isTraceEnabled()) {
                    ZooTrace.logTraceMessage(LOG,
                            ZooTrace.EVENT_DELIVERY_TRACE_MASK,
                            "No watchers for " + path);
                }
                return null;
            }
            //从watch2Paths中remove当前事件的watcher
            for (Watcher w : watchers) {
                HashSet<String> paths = watch2Paths.get(w);
                if (paths != null) {
                    paths.remove(path);
                }
            }
        }
        for (Watcher w : watchers) {
            if (supress != null && supress.contains(w)) {
                continue;
            }
            //服务端回调wathcer.processs(WatchedEvent) 由于客户端传到服务端只是是否存在watcher的标识
            //在FinalRequestProcessor.processRequest()的getData等逻辑 是就将ServerCnxn作为服务端的watcher以及节点路径传递给getData方法
            //最终ServerCnxn和数据节点路径都是保持在了WatchManager中的WatchTable和watch2Paths中
            //ServerCnxn默认实现为NIOServerCnxn 也有Netty实现NettyServerCnxn
            //因此此处是调用了NIOServerCnxn的process方法 将watchedEvent对象包装成WatcherEvent返回给客户端
            w.process(e);
        }
        return watchers;
    }

    /**
     * Brief description of this object.
     */
    @Override
    public synchronized String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append(watch2Paths.size()).append(" connections watching ")
            .append(watchTable.size()).append(" paths\n");

        int total = 0;
        for (HashSet<String> paths : watch2Paths.values()) {
            total += paths.size();
        }
        sb.append("Total watches:").append(total);

        return sb.toString();
    }

    /**
     * String representation of watches. Warning, may be large!
     * @param byPath iff true output watches by paths, otw output
     * watches by connection
     * @return string representation of watches
     */
    public synchronized void dumpWatches(PrintWriter pwriter, boolean byPath) {
        if (byPath) {
            for (Entry<String, HashSet<Watcher>> e : watchTable.entrySet()) {
                pwriter.println(e.getKey());
                for (Watcher w : e.getValue()) {
                    pwriter.print("\t0x");
                    pwriter.print(Long.toHexString(((ServerCnxn)w).getSessionId()));
                    pwriter.print("\n");
                }
            }
        } else {
            for (Entry<Watcher, HashSet<String>> e : watch2Paths.entrySet()) {
                pwriter.print("0x");
                pwriter.println(Long.toHexString(((ServerCnxn)e.getKey()).getSessionId()));
                for (String path : e.getValue()) {
                    pwriter.print("\t");
                    pwriter.println(path);
                }
            }
        }
    }
}


text:
package de.greenrobot.eventperf;

/** Used by otto and EventBus */
public class TestEvent {

}


text:
package org.apache.phoenix.tx;

import static org.apache.phoenix.util.TestUtil.INDEX_DATA_SCHEMA;
import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.IOException;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;

import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseIOException;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.TableNotFoundException;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.SimpleRegionObserver;
import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
import org.apache.phoenix.exception.SQLExceptionCode;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixDatabaseMetaData;
import org.apache.phoenix.query.QueryConstants;
import org.apache.phoenix.query.QueryServicesOptions;
import org.apache.phoenix.schema.PTable;
import org.apache.phoenix.schema.PTableKey;
import org.apache.phoenix.transaction.PhoenixTransactionContext;
import org.apache.phoenix.transaction.PhoenixTransactionProvider;
import org.apache.phoenix.transaction.PhoenixTransactionProvider.Feature;
import org.apache.phoenix.transaction.TransactionFactory;
import org.apache.phoenix.util.EnvironmentEdgeManager;
import org.apache.phoenix.util.PhoenixRuntime;
import org.apache.phoenix.util.PropertiesUtil;
import org.apache.phoenix.util.StringUtil;
import org.apache.phoenix.util.TestUtil;
import org.apache.tephra.TxConstants;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;

import com.google.common.collect.Lists;

@RunWith(Parameterized.class)
public class TransactionIT  extends ParallelStatsDisabledIT {
    private final String txProvider;
    private final String tableDDLOptions;

    public TransactionIT(String provider) {
        txProvider = provider;
        tableDDLOptions = PhoenixDatabaseMetaData.TRANSACTION_PROVIDER + "='" + provider + "'";
    }

    @Parameters(name="TransactionIT_provider={0}") // name is used by failsafe as file name in reports
    public static Collection<Object[]> data() {
        return TestUtil.filterTxParamData(Arrays.asList(new Object[][] {
                 {"TEPHRA"},{"OMID"}}),0);
    }

    @Test
    public void testFailureToRollbackAfterDelete() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
            String tableName = generateUniqueName();
            conn.createStatement().execute(
                    "CREATE TABLE " + tableName + " (k VARCHAR NOT NULL PRIMARY KEY) TRANSACTIONAL=true,TRANSACTION_PROVIDER='" + txProvider + "'");
            conn.createStatement().execute("UPSERT INTO " + tableName + " VALUES('a')");
            conn.createStatement().execute("UPSERT INTO " + tableName + " VALUES('b')");
            conn.commit();
            // Delete a in new transaction
            conn.createStatement().execute("DELETE FROM " + tableName + " WHERE k='a'");
            // Forces data to be written to HBase, but not yet committed
            conn.createStatement().executeQuery("SELECT * FROM " + tableName).next();
            // Upsert another row so commit below will fail the write (and fail subsequent attempt t o abort)
            conn.createStatement().execute("UPSERT INTO " + tableName + " VALUES('c')");
            TestUtil.addCoprocessor(conn, tableName, WriteFailingRegionObserver.class);
            try {
                conn.commit();
                fail();
            } catch (SQLException e) {
            }
            // Delete of a shouldn't be visible since commit failed, so all rows should be present
            ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + tableName);
            assertTrue(rs.next());
            assertEquals("a", rs.getString(1));
            assertTrue(rs.next());
            assertEquals("b", rs.getString(1));
            assertFalse(rs.next());
        }
    }

    public static class WriteFailingRegionObserver extends SimpleRegionObserver {
        @Override
        public void preBatchMutate(ObserverContext<RegionCoprocessorEnvironment> c, MiniBatchOperationInProgress<Mutation> miniBatchOp) throws HBaseIOException {
            throw new DoNotRetryIOException();
        }
    }

    @Test
    public void testWithMixOfTxProviders() throws Exception {
        // No sense in running the test with every providers, so just run it with the default one
        if (!TransactionFactory.Provider.valueOf(txProvider).equals(TransactionFactory.Provider.getDefault())) {
            return;
        }
        List<String> tableNames = Lists.newArrayList();
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
            for (TransactionFactory.Provider provider : TransactionFactory.Provider.values()) {
                if (provider.runTests()) {
                    String tableName = generateUniqueName();
                    tableNames.add(tableName);
                    conn.createStatement().execute(
                            "CREATE TABLE " + tableName + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR) TRANSACTIONAL=true,TRANSACTION_PROVIDER='" + provider + "'");
                }
            }
            if (tableNames.size() < 2) {
                return;
            }
            Iterator<String> iterator = tableNames.iterator();
            String tableName1 = iterator.next();
            conn.createStatement().execute("UPSERT INTO " + tableName1 + " VALUES('a')");
            String tableName2 = iterator.next();
            try {
                conn.createStatement().execute("UPSERT INTO " + tableName2 + " VALUES('a')");
                fail();
            } catch (SQLException e) {
                assertEquals(SQLExceptionCode.CANNOT_MIX_TXN_PROVIDERS.getErrorCode(), e.getErrorCode());
            }

            conn.rollback();
            conn.setAutoCommit(true);
            for (String tableName : tableNames) {
                conn.createStatement().execute("UPSERT INTO " + tableName + " VALUES('a')");
            }
            for (String tableName : tableNames) {
                ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + tableName);
                assertTrue(rs.next());
                assertEquals("a", rs.getString(1));
                assertFalse(rs.next());
            }
        }
    }

    @Test
    public void testPreventLocalIndexCreation() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
            for (TransactionFactory.Provider provider : TransactionFactory.Provider.values()) {
                if (provider.runTests() && provider.getTransactionProvider().isUnsupported(PhoenixTransactionProvider.Feature.ALLOW_LOCAL_INDEX)) {
                    String tableName = generateUniqueName();
                    conn.createStatement().execute(
                            "CREATE TABLE " + tableName + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR) TRANSACTIONAL=true,TRANSACTION_PROVIDER='" + provider + "'");
                    String indexName = generateUniqueName();
                    try {
                        conn.createStatement().execute("CREATE LOCAL INDEX " + indexName + "_IDX ON " + tableName + " (v1) INCLUDE(v2)");
                        fail();
                    } catch (SQLException e) {
                        assertEquals(SQLExceptionCode.CANNOT_CREATE_LOCAL_INDEX_FOR_TXN_TABLE.getErrorCode(), e.getErrorCode());
                    }
                }
            }
        }
    }

    @Test
    public void testQueryWithSCN() throws Exception {
        String tableName = generateUniqueName();
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        try (Connection conn = DriverManager.getConnection(getUrl(), props);) {
            conn.createStatement().execute(
                    "CREATE TABLE " + tableName + " (k VARCHAR NOT NULL PRIMARY KEY, v1 VARCHAR) TRANSACTIONAL=true," + tableDDLOptions);
        }
        props.put(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(EnvironmentEdgeManager.currentTimeMillis()));
        try (Connection conn = DriverManager.getConnection(getUrl(), props);) {
            try {
            	conn.createStatement().executeQuery("SELECT * FROM " + tableName);
                fail();
            } catch (SQLException e) {
                assertEquals("Unexpected Exception",
                        SQLExceptionCode.CANNOT_START_TRANSACTION_WITH_SCN_SET
                                .getErrorCode(), e.getErrorCode());
            }
        }
    }

    @Test
    public void testReCreateTxnTableAfterDroppingExistingNonTxnTable() throws Exception {
        String tableName = generateUniqueName();
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        Connection conn = DriverManager.getConnection(getUrl(), props);
        conn.setAutoCommit(false);
        Statement stmt = conn.createStatement();
        stmt.execute("CREATE TABLE " + tableName + "(k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)");
        stmt.execute("DROP TABLE " + tableName);
        // Must drop metadata as Omid does not allow creating a transactional table from a non transactional one
        Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();
        admin.disableTable(TableName.valueOf(tableName));
        admin.deleteTable(TableName.valueOf(tableName));
        stmt.execute("CREATE TABLE " + tableName + "(k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) TRANSACTIONAL=true," + tableDDLOptions);
        stmt.execute("CREATE INDEX " + tableName + "_IDX ON " + tableName + " (v1) INCLUDE(v2)");
        assertTrue(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null, tableName)).isTransactional());
        assertTrue(conn.unwrap(PhoenixConnection.class).getTable(new PTableKey(null,  tableName + "_IDX")).isTransactional());
    }

    @Test
    public void testRowTimestampDisabled() throws SQLException {
        String tableName = generateUniqueName();
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
            conn.setAutoCommit(false);
            Statement stmt = conn.createStatement();
            try {
                stmt.execute("CREATE TABLE " + tableName + "(k VARCHAR, v VARCHAR, d DATE NOT NULL, CONSTRAINT PK PRIMARY KEY(k,d ROW_TIMESTAMP)) TRANSACTIONAL=true," + tableDDLOptions);
                fail();
            }
            catch(SQLException e) {
                assertEquals(SQLExceptionCode.CANNOT_CREATE_TXN_TABLE_WITH_ROW_TIMESTAMP.getErrorCode(), e.getErrorCode());
            }
            stmt.execute("CREATE TABLE " + tableName + "(k VARCHAR, v VARCHAR, d DATE NOT NULL, CONSTRAINT PK PRIMARY KEY(k,d ROW_TIMESTAMP))");
            try {
                stmt.execute("ALTER TABLE " + tableName + " SET TRANSACTIONAL=true");
                fail();
            }
            catch(SQLException e) {
                assertEquals(SQLExceptionCode.CANNOT_ALTER_TO_BE_TXN_WITH_ROW_TIMESTAMP.getErrorCode(), e.getErrorCode());
            }
        }
    }

    @Test
    public void testTransactionalTableMetadata() throws SQLException {

        try (Connection conn = DriverManager.getConnection(getUrl())) {
            String transactTableName = generateUniqueName();
            Statement stmt = conn.createStatement();
            stmt.execute("CREATE TABLE " + transactTableName + " (k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " +
                "TRANSACTIONAL=true," + tableDDLOptions);
            conn.commit();

            DatabaseMetaData dbmd = conn.getMetaData();
            ResultSet rs = dbmd.getTables(null, null, StringUtil.escapeLike(transactTableName), null);
            assertTrue(rs.next());
            assertEquals("Transactional table was not marked as transactional in JDBC API.",
                "true", rs.getString(PhoenixDatabaseMetaData.TRANSACTIONAL));
            assertEquals(txProvider, rs.getString(PhoenixDatabaseMetaData.TRANSACTION_PROVIDER));

            // Ensure round-trip-ability of TRANSACTION_PROVIDER
            PTable table = PhoenixRuntime.getTableNoCache(conn, transactTableName);
            assertEquals(txProvider, table.getTransactionProvider().name());

            String nonTransactTableName = generateUniqueName();
            Statement stmt2 = conn.createStatement();
            stmt2.execute("CREATE TABLE " + nonTransactTableName + "(k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) ");
            conn.commit();

            ResultSet rs2 = dbmd.getTables(null, null, StringUtil.escapeLike(nonTransactTableName), null);
            assertTrue(rs2.next());
            assertEquals("Non-transactional table was marked as transactional in JDBC API.",
                "false", rs2.getString(PhoenixDatabaseMetaData.TRANSACTIONAL));
            assertNull(rs2.getString(PhoenixDatabaseMetaData.TRANSACTION_PROVIDER));

            try {
                stmt.execute("CREATE TABLE " + transactTableName + " (k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " +
                        "TRANSACTION_PROVIDER=foo");
                fail();
            } catch (SQLException e) {
                assertEquals(SQLExceptionCode.UNKNOWN_TRANSACTION_PROVIDER.getErrorCode(), e.getErrorCode());
            }
        }
    }

    @Test
    public void testOnDupKeyForTransactionalTable() throws Exception {
        // TODO: we should support having a transactional table defined for a connectionless connection
        try (Connection conn = DriverManager.getConnection(getUrl())) {
            String transactTableName = generateUniqueName();
            conn.createStatement().execute("CREATE TABLE " + transactTableName + " (k integer not null primary key, v bigint) TRANSACTIONAL=true," + tableDDLOptions);
            conn.createStatement().execute("UPSERT INTO " + transactTableName + " VALUES(0,0) ON DUPLICATE KEY UPDATE v = v + 1");
            fail();
        } catch (SQLException e) {
            assertEquals(SQLExceptionCode.CANNOT_USE_ON_DUP_KEY_FOR_TRANSACTIONAL.getErrorCode(), e.getErrorCode());
        }
    }

    @Test
    public void testProperties() throws Exception {
        String nonTxTableName = generateUniqueName();
        String txTableName = generateUniqueName();
        String idx1 = generateUniqueName();
        String idx2 = generateUniqueName();

        Connection conn = DriverManager.getConnection(getUrl());
        conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "1(k INTEGER PRIMARY KEY, a.v VARCHAR, b.v VARCHAR, c.v VARCHAR) TTL=1000");
        conn.createStatement().execute("CREATE INDEX " + idx1 + " ON " + nonTxTableName + "1(a.v, b.v)");
        conn.createStatement().execute("CREATE INDEX " + idx2 + " ON " + nonTxTableName + "1(c.v) INCLUDE (a.v, b.v)");

        try {
            conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "1 SET TRANSACTIONAL=true," + tableDDLOptions);
            if (TransactionFactory.Provider.valueOf(txProvider).getTransactionProvider().isUnsupported(Feature.ALTER_NONTX_TO_TX)) {
                fail(txProvider + " should not allow converting a non transactional table to be transactional");
            }
        } catch (SQLException e) { // Should fail for Omid, but not Tephra
            if (!TransactionFactory.Provider.valueOf(txProvider).getTransactionProvider().isUnsupported(Feature.ALTER_NONTX_TO_TX)) {
                throw e;
            }
            assertEquals(SQLExceptionCode.CANNOT_ALTER_TABLE_FROM_NON_TXN_TO_TXNL.getErrorCode(), e.getErrorCode());
            // FIXME: should verify Omid table properties too, but the checks below won't be valid for Omid
            return;
        }

        TableDescriptor desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes(nonTxTableName + "1"));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(QueryServicesOptions.DEFAULT_MAX_VERSIONS_TRANSACTIONAL, colDesc.getMaxVersions());
            assertEquals(1000, colDesc.getTimeToLive());
            byte[] propertyTTL = colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES);
            assertEquals(1000, Integer.parseInt(Bytes.toString(propertyTTL)));
        }

        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes(idx1));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(QueryServicesOptions.DEFAULT_MAX_VERSIONS_TRANSACTIONAL, colDesc.getMaxVersions());
            assertEquals(1000, colDesc.getTimeToLive());
            byte[] propertyTTL = colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES);
            assertEquals(1000, Integer.parseInt(Bytes.toString(propertyTTL)));
        }

        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes(idx2));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(QueryServicesOptions.DEFAULT_MAX_VERSIONS_TRANSACTIONAL, colDesc.getMaxVersions());
            assertEquals(1000, colDesc.getTimeToLive());
            byte[] propertyTTL = colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES);
            assertEquals(1000, Integer.parseInt(Bytes.toString(propertyTTL)));
        }

        conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "2(k INTEGER PRIMARY KEY, a.v VARCHAR, b.v VARCHAR, c.v VARCHAR)");
        conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "2 SET TRANSACTIONAL=true, VERSIONS=10, " + tableDDLOptions);
        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes( nonTxTableName + "2"));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(10, colDesc.getMaxVersions());
            assertEquals(ColumnFamilyDescriptorBuilder.DEFAULT_TTL, colDesc.getTimeToLive());
            assertEquals(null, colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES));
        }
        conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "2 SET TTL=1000");
        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes( nonTxTableName + "2"));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(10, colDesc.getMaxVersions());
            assertEquals(1000, colDesc.getTimeToLive());
            byte[] propertyTTL = colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES);
            assertEquals(1000, Integer.parseInt(Bytes.toString(propertyTTL)));
        }

        conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "3(k INTEGER PRIMARY KEY, a.v VARCHAR, b.v VARCHAR, c.v VARCHAR)");
        conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "3 SET TRANSACTIONAL=true, b.VERSIONS=10, c.VERSIONS=20," + tableDDLOptions);
        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes( nonTxTableName + "3"));
        assertEquals(QueryServicesOptions.DEFAULT_MAX_VERSIONS_TRANSACTIONAL, desc.getColumnFamily(Bytes.toBytes("A")).getMaxVersions());
        assertEquals(10, desc.getColumnFamily(Bytes.toBytes("B")).getMaxVersions());
        assertEquals(20, desc.getColumnFamily(Bytes.toBytes("C")).getMaxVersions());

        conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "4(k INTEGER PRIMARY KEY, a.v VARCHAR, b.v VARCHAR, c.v VARCHAR)");
        try {
            conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "4 SET TRANSACTIONAL=true, VERSIONS=1," + tableDDLOptions);
            fail();
        } catch (SQLException e) {
            assertEquals(SQLExceptionCode.TX_MAX_VERSIONS_MUST_BE_GREATER_THAN_ONE.getErrorCode(), e.getErrorCode());
        }

        try {
            conn.createStatement().execute("ALTER TABLE " + nonTxTableName + "4 SET TRANSACTIONAL=true, b.VERSIONS=1," + tableDDLOptions);
            fail();
        } catch (SQLException e) {
            assertEquals(SQLExceptionCode.TX_MAX_VERSIONS_MUST_BE_GREATER_THAN_ONE.getErrorCode(), e.getErrorCode());
        }

        conn.createStatement().execute("CREATE TABLE " + txTableName + "(k INTEGER PRIMARY KEY, v VARCHAR) TTL=1000, TRANSACTIONAL=true," + tableDDLOptions);
        desc = conn.unwrap(PhoenixConnection.class).getQueryServices().getTableDescriptor(Bytes.toBytes(txTableName));
        for (ColumnFamilyDescriptor colDesc : desc.getColumnFamilies()) {
            assertEquals(QueryServicesOptions.DEFAULT_MAX_VERSIONS_TRANSACTIONAL, colDesc.getMaxVersions());
            assertEquals(ColumnFamilyDescriptorBuilder.DEFAULT_TTL, colDesc.getTimeToLive());
            byte[] propertyTTL = colDesc.getValue(PhoenixTransactionContext.PROPERTY_TTL_BYTES);
            assertEquals(1000, Integer.parseInt(Bytes.toString(propertyTTL)));
        }
    }

    @Test
    public void testColConflicts() throws Exception {
        String transTableName = generateUniqueName();
        String fullTableName = INDEX_DATA_SCHEMA + QueryConstants.NAME_SEPARATOR + transTableName;
        try (Connection conn1 = DriverManager.getConnection(getUrl());
                Connection conn2 = DriverManager.getConnection(getUrl())) {
            TestUtil.createTransactionalTable(conn1, fullTableName, tableDDLOptions);
            conn1.setAutoCommit(false);
            conn2.setAutoCommit(false);
            String selectSql = "SELECT * FROM "+fullTableName;
            conn1.setAutoCommit(false);
            ResultSet rs = conn1.createStatement().executeQuery(selectSql);
            assertFalse(rs.next());
            // upsert row using conn1
            String upsertSql = "UPSERT INTO " + fullTableName + "(varchar_pk, char_pk, int_pk, long_pk, decimal_pk, date_pk, a.int_col1) VALUES(?, ?, ?, ?, ?, ?, ?)";
            PreparedStatement stmt = conn1.prepareStatement(upsertSql);
            TestUtil.setRowKeyColumns(stmt, 1);
            stmt.setInt(7, 10);
            stmt.execute();
            // upsert row using conn2
            stmt = conn2.prepareStatement(upsertSql);
            TestUtil.setRowKeyColumns(stmt, 1);
            stmt.setInt(7, 11);
            stmt.execute();

            conn1.commit();
            //second commit should fail
            try {
                conn2.commit();
                fail();
            }
            catch (SQLException e) {
                assertEquals(e.getErrorCode(), SQLExceptionCode.TRANSACTION_CONFLICT_EXCEPTION.getErrorCode());
            }
        }
    }

    @Test
    public void testCheckpointAndRollback() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        Connection conn = DriverManager.getConnection(getUrl(), props);
        String fullTableName = generateUniqueName();
        conn.setAutoCommit(false);
        try {
            Statement stmt = conn.createStatement();
            stmt.execute("CREATE TABLE " + fullTableName + "(k VARCHAR PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) TRANSACTIONAL=true," + tableDDLOptions);
            stmt.executeUpdate("upsert into " + fullTableName + " values('x', 'a', 'a')");
            conn.commit();

            stmt.executeUpdate("upsert into " + fullTableName + "(k,v1) SELECT k,v1||'a' FROM " + fullTableName);
            ResultSet rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName);
            assertTrue(rs.next());
            assertEquals("x", rs.getString(1));
            assertEquals("aa", rs.getString(2));
            assertEquals("a", rs.getString(3));
            assertFalse(rs.next());

            stmt.executeUpdate("upsert into " + fullTableName + "(k,v1) SELECT k,v1||'a' FROM " + fullTableName);

            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName);
            assertTrue(rs.next());
            assertEquals("x", rs.getString(1));
            assertEquals("aaa", rs.getString(2));
            assertEquals("a", rs.getString(3));
            assertFalse(rs.next());

            conn.rollback();

            //assert original row exists in fullTableName1
            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName);
            assertTrue(rs.next());
            assertEquals("x", rs.getString(1));
            assertEquals("a", rs.getString(2));
            assertEquals("a", rs.getString(3));
            assertFalse(rs.next());

        } finally {
            conn.close();
        }
    }

    private static void assertTTL(Admin admin, String tableName, int ttl) throws Exception {
        TableDescriptor tableDesc = admin.getTableDescriptor(TableName.valueOf(tableName));
        for (ColumnFamilyDescriptor colDesc : tableDesc.getColumnFamilies()) {
            assertEquals(ttl,Integer.parseInt(Bytes.toString(colDesc.getValue(Bytes.toBytes(TxConstants.PROPERTY_TTL)))));
            assertEquals(ColumnFamilyDescriptorBuilder.DEFAULT_TTL,colDesc.getTimeToLive());
        }
    }

    @Test
    public void testSetTTL() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
        TransactionFactory.Provider txProvider = TransactionFactory.Provider.valueOf(this.txProvider);
        try (Connection conn = DriverManager.getConnection(getUrl(), props);
             Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin()) {
            String tableName = generateUniqueName();
            try {
                conn.createStatement().execute("CREATE TABLE " + tableName +
                        "(K VARCHAR PRIMARY KEY) TRANSACTIONAL=true,TRANSACTION_PROVIDER='" + txProvider + "',TTL=100");
                if (txProvider.getTransactionProvider().isUnsupported(Feature.SET_TTL)) {
                    fail();
                }
                assertTTL(admin, tableName, 100);
            } catch (SQLException e) {
                if (txProvider.getTransactionProvider().isUnsupported(Feature.SET_TTL)) {
                    assertEquals(SQLExceptionCode.TTL_UNSUPPORTED_FOR_TXN_TABLE.getErrorCode(), e.getErrorCode());
                } else {
                    throw e;
                }
            }
            tableName = generateUniqueName();
            conn.createStatement().execute("CREATE TABLE " + tableName +
                    "(K VARCHAR PRIMARY KEY) TRANSACTIONAL=true,TRANSACTION_PROVIDER='" + txProvider + "'");
            try {
                conn.createStatement().execute("ALTER TABLE " + tableName + " SET TTL=" + 200);
                if (txProvider.getTransactionProvider().isUnsupported(Feature.SET_TTL)) {
                    fail();
                }
                assertTTL(admin, tableName, 200);
            } catch (SQLException e) {
                if (txProvider.getTransactionProvider().isUnsupported(Feature.SET_TTL)) {
                    assertEquals(SQLExceptionCode.TTL_UNSUPPORTED_FOR_TXN_TABLE.getErrorCode(), e.getErrorCode());
                } else {
                    throw e;
                }
            }
        }
    }
}


text:
import hug, requests, datetime
from dateutil import parser

dewanRakyatID = '53633b5a19ee29270d8a9ecf'

@hug.get(examples='base_url=http://api.popit.sinarproject.org/&orgID=53633b5a19ee29270d8a9ecf')
@hug.local()
def genAllMemberIDs(base_url: hug.types.text, orgID:hug.types.text):
    '''
    Generate all member IDs for an organization
    '''

    url = base_url+ "/en/organizations/" + orgID + "/?minify=True"
    r = requests.get(url).json()['result']
    membershipIDs = r['memberships']

    return membershipIDs

@hug.get(examples='base_url=http://api.popit.sinarproject.org/&start_date=2008-04-28&end_date=2013-04-03')
@hug.local()
def MPmemIDs_date(base_url: hug.types.text, start_date:hug.types.text, end_date:hug.types.text):
    '''
    Generate memberIDs of parliamentarians between start&end date
    '''

    memberIDs = []
    membershipIDs = genAllMemberIDs(base_url, dewanRakyatID)

    start_datetime = parser.parse(start_date)
    end_datetime = parser.parse(end_date)

    for membership_id in membershipIDs:
        url = base_url+ "/en/memberships/"+ membership_id
        member = requests.get(url).json()['result']

        if member['start_date']:
            if member['end_date']: #has end date, ex member
                memStart = parser.parse(member['start_date'])
                memEnd = parser.parse(member['end_date'])
                if memStart >= start_datetime and memEnd <= end_datetime:
                    memberIDs.append(membership_id)
            else:
                memStart = parser.parse(member['start_date'])
                if memStart >= start_datetime and memStart<= end_datetime:
                    memberIDs.append(membership_id)

    return memberIDs

@hug.get(examples='base_url=http://api.popit.sinarproject.org/&start_date=2013-04-03')
@hug.local()
def currentMPmemIDs(base_url: hug.types.text, start_date:hug.types.text):
    '''
    Generate memberIDs of current parliamentarians
    '''
    memberIDs = []
    membershipIDs = genAllMemberIDs(base_url, dewanRakyatID)

    start_datetime = parser.parse(start_date)

    for membership_id in membershipIDs:
        url = base_url+ "/en/memberships/"+ membership_id
        member = requests.get(url).json()['result']
        if member['start_date']:
            memStart = parser.parse(member['start_date'])

            if memStart >= start_datetime and not member['end_date']:
                memberIDs.append(membership_id)

    return memberIDs

@hug.get(examples='base_url=http://api.popit.sinarproject.org/&start_date=2008-04-28&end_date=2013-04-03')
@hug.local()
def MPMemberships(base_url: hug.types.text, start_date:hug.types.text, end_date:hug.types.text):
    '''
    Returns json of mem details of all parliamentarians between start and end date
    '''
    memberships = MPmemIDs_date(base_url, start_date, end_date)
    memberships_json = []

    for membership_id in memberships:
        url = base_url+ "/en/memberships/"+ membership_id
        r = requests.get(url).json()['result']

        memberships_json.append(r)

    return memberships_json

@hug.get(examples='base_url=http://api.popit.sinarproject.org/&start_date=2013-04-03')
@hug.local()
def currentMPMemberships(base_url: hug.types.text, orgID:hug.types.text, start_date:hug.types.text, end_date:hug.types.text):
    '''
    Returns json of mem details of all current parliamentarians.
    '''
    memberships = currentMPmemIDs(base_url, start_date)
    memberships_json = []

    for membership_id in memberships:
        url = base_url+ "/en/memberships/"+ membership_id
        r = requests.get(url).json()['result']

        memberships_json.append(r)

    return memberships_json


text:
package org.apache.flink.runtime.scheduler;

import org.apache.flink.api.common.time.Time;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.runtime.clusterframework.types.AllocationID;
import org.apache.flink.runtime.clusterframework.types.ResourceProfile;
import org.apache.flink.runtime.clusterframework.types.SlotProfile;
import org.apache.flink.runtime.executiongraph.SlotProviderStrategy;
import org.apache.flink.runtime.instance.SlotSharingGroupId;
import org.apache.flink.runtime.jobgraph.JobVertexID;
import org.apache.flink.runtime.jobgraph.ScheduleMode;
import org.apache.flink.runtime.jobmanager.scheduler.CoLocationConstraint;
import org.apache.flink.runtime.jobmanager.scheduler.CoLocationGroup;
import org.apache.flink.runtime.jobmanager.scheduler.ScheduledUnit;
import org.apache.flink.runtime.jobmaster.LogicalSlot;
import org.apache.flink.runtime.jobmaster.SlotRequestId;
import org.apache.flink.runtime.jobmaster.TestingLogicalSlotBuilder;
import org.apache.flink.runtime.jobmaster.slotpool.SlotProvider;
import org.apache.flink.runtime.scheduler.strategy.ExecutionVertexID;
import org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation;
import org.apache.flink.runtime.taskmanager.TaskManagerLocation;
import org.apache.flink.util.TestLogger;

import org.junit.Before;
import org.junit.Test;

import javax.annotation.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CancellationException;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

/**
 * Tests for {@link DefaultExecutionSlotAllocator}.
 */
public class DefaultExecutionSlotAllocatorTest extends TestLogger {

	private AllocationToggableSlotProvider slotProvider;

	@Before
	public void setUp() throws Exception {
		slotProvider = new AllocationToggableSlotProvider();
	}

	/**
	 * Tests that consumers will get slots after producers are fulfilled.
	 */
	@Test
	public void testConsumersAssignedToSlotsAfterProducers() {
		final ExecutionVertexID producerId = new ExecutionVertexID(new JobVertexID(), 0);
		final ExecutionVertexID consumerId = new ExecutionVertexID(new JobVertexID(), 0);

		final TestingInputsLocationsRetriever inputsLocationsRetriever = new TestingInputsLocationsRetriever.Builder()
				.connectConsumerToProducer(consumerId, producerId)
				.build();

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator(inputsLocationsRetriever);

		inputsLocationsRetriever.markScheduled(producerId);
		inputsLocationsRetriever.markScheduled(consumerId);

		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements = createSchedulingRequirements(producerId, consumerId);
		final Collection<SlotExecutionVertexAssignment> slotExecutionVertexAssignments = executionSlotAllocator.allocateSlotsFor(schedulingRequirements);
		assertThat(slotExecutionVertexAssignments, hasSize(2));

		final SlotExecutionVertexAssignment producerSlotAssignment = findSlotAssignmentByExecutionVertexId(producerId, slotExecutionVertexAssignments);
		final SlotExecutionVertexAssignment consumerSlotAssignment = findSlotAssignmentByExecutionVertexId(consumerId, slotExecutionVertexAssignments);

		assertTrue(producerSlotAssignment.getLogicalSlotFuture().isDone());
		assertFalse(consumerSlotAssignment.getLogicalSlotFuture().isDone());

		inputsLocationsRetriever.assignTaskManagerLocation(producerId);

		assertTrue(consumerSlotAssignment.getLogicalSlotFuture().isDone());
		assertEquals(0, executionSlotAllocator.getNumberOfPendingSlotAssignments());
	}

	/**
	 * Tests that validate the parameters when calling allocateSlot in SlotProvider.
	 */
	@Test
	public void testAllocateSlotsParameters() {
		final ExecutionVertexID executionVertexId = new ExecutionVertexID(new JobVertexID(), 0);
		final AllocationID allocationId = new AllocationID();
		final SlotSharingGroupId sharingGroupId = new SlotSharingGroupId();
		final ResourceProfile resourceProfile = new ResourceProfile(0.5, 250);
		final CoLocationConstraint coLocationConstraint = new CoLocationGroup().getLocationConstraint(0);
		final Collection<TaskManagerLocation> taskManagerLocations = Collections.singleton(new LocalTaskManagerLocation());

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();

		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements = Arrays.asList(
				new ExecutionVertexSchedulingRequirements.Builder()
						.withExecutionVertexId(executionVertexId)
						.withPreviousAllocationId(allocationId)
						.withSlotSharingGroupId(sharingGroupId)
						.withPreferredLocations(taskManagerLocations)
						.withResourceProfile(resourceProfile)
						.withCoLocationConstraint(coLocationConstraint)
						.build()
		);

		executionSlotAllocator.allocateSlotsFor(schedulingRequirements);
		assertThat(slotProvider.getSlotAllocationRequests(), hasSize(1));

		ScheduledUnit expectedTask = slotProvider.getSlotAllocationRequests().get(0).f1;
		SlotProfile expectedSlotProfile = slotProvider.getSlotAllocationRequests().get(0).f2;

		assertEquals(sharingGroupId, expectedTask.getSlotSharingGroupId());
		assertEquals(coLocationConstraint, expectedTask.getCoLocationConstraint());
		assertThat(expectedSlotProfile.getPreferredAllocations(), contains(allocationId));
		assertThat(expectedSlotProfile.getPreviousExecutionGraphAllocations(), contains(allocationId));
		assertEquals(resourceProfile, expectedSlotProfile.getResourceProfile());
		assertThat(expectedSlotProfile.getPreferredLocations(), contains(taskManagerLocations.toArray()));
	}

	/**
	 * Tests that cancels an execution vertex which is not existed.
	 */
	@Test
	public void testCancelNonExistingExecutionVertex() {
		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();

		ExecutionVertexID inValidExecutionVertexId = new ExecutionVertexID(new JobVertexID(), 0);
		executionSlotAllocator.cancel(inValidExecutionVertexId);

		assertThat(slotProvider.getCancelledSlotRequestIds(), is(empty()));
	}

	/**
	 * Tests that cancels a slot request which has already been fulfilled.
	 */
	@Test
	public void testCancelFulfilledSlotRequest() {
		final ExecutionVertexID producerId = new ExecutionVertexID(new JobVertexID(), 0);

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();

		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements =
				createSchedulingRequirements(producerId);
		executionSlotAllocator.allocateSlotsFor(schedulingRequirements);

		executionSlotAllocator.cancel(producerId);

		assertThat(slotProvider.getCancelledSlotRequestIds(), is(empty()));
	}

	/**
	 * Tests that cancels a slot request which has not been fulfilled.
	 */
	@Test
	public void testCancelUnFulfilledSlotRequest() throws Exception {
		final ExecutionVertexID producerId = new ExecutionVertexID(new JobVertexID(), 0);

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();

		slotProvider.disableSlotAllocation();
		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements =
				createSchedulingRequirements(producerId);
		Collection<SlotExecutionVertexAssignment> assignments = executionSlotAllocator.allocateSlotsFor(schedulingRequirements);

		executionSlotAllocator.cancel(producerId);

		assertThat(slotProvider.getCancelledSlotRequestIds(), hasSize(1));
		assertThat(slotProvider.getCancelledSlotRequestIds(), contains(slotProvider.getReceivedSlotRequestIds().toArray()));

		try {
			assignments.iterator().next().getLogicalSlotFuture().get();
			fail("Expect a CancellationException but got nothing.");
		} catch (CancellationException ignored) {
			// Expected exception
		}
	}

	/**
	 * Tests that all unfulfilled slot requests will be cancelled when stopped.
	 */
	@Test
	public void testStop() throws Exception {
		final ExecutionVertexID executionVertexId = new ExecutionVertexID(new JobVertexID(), 0);

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();

		slotProvider.disableSlotAllocation();
		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements =
				createSchedulingRequirements(executionVertexId);
		executionSlotAllocator.allocateSlotsFor(schedulingRequirements);

		executionSlotAllocator.stop().get();

		assertThat(slotProvider.getCancelledSlotRequestIds(), hasSize(1));
		assertThat(slotProvider.getCancelledSlotRequestIds(), contains(slotProvider.getReceivedSlotRequestIds().toArray()));
		assertEquals(0, executionSlotAllocator.getNumberOfPendingSlotAssignments());
	}

	/**
	 * Tests that all prior allocation ids are computed by union all previous allocation ids in scheduling requirements.
	 */
	@Test
	public void testComputeAllPriorAllocationIds() {
		List<AllocationID> expectAllocationIds = Arrays.asList(new AllocationID(), new AllocationID());
		List<ExecutionVertexSchedulingRequirements> testSchedulingRequirements = Arrays.asList(
				new ExecutionVertexSchedulingRequirements.Builder().
						withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 0)).
						withPreviousAllocationId(expectAllocationIds.get(0)).
						build(),
				new ExecutionVertexSchedulingRequirements.Builder().
						withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 1)).
						withPreviousAllocationId(expectAllocationIds.get(0)).
						build(),
				new ExecutionVertexSchedulingRequirements.Builder().
						withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 2)).
						withPreviousAllocationId(expectAllocationIds.get(1)).
						build(),
				new ExecutionVertexSchedulingRequirements.Builder().
						withExecutionVertexId(new ExecutionVertexID(new JobVertexID(), 3)).
						build()
		);

		Set<AllocationID> allPriorAllocationIds = DefaultExecutionSlotAllocator.computeAllPriorAllocationIds(testSchedulingRequirements);
		assertThat(allPriorAllocationIds, containsInAnyOrder(expectAllocationIds.toArray()));
	}

	@Test
	public void testDuplicatedSlotAllocationIsNotAllowed() {
		final ExecutionVertexID executionVertexId = new ExecutionVertexID(new JobVertexID(), 0);

		final DefaultExecutionSlotAllocator executionSlotAllocator = createExecutionSlotAllocator();
		slotProvider.disableSlotAllocation();

		final List<ExecutionVertexSchedulingRequirements> schedulingRequirements =
			createSchedulingRequirements(executionVertexId);
		executionSlotAllocator.allocateSlotsFor(schedulingRequirements);

		try {
			executionSlotAllocator.allocateSlotsFor(schedulingRequirements);
			fail("exception should happen");
		} catch (IllegalStateException e) {
			// IllegalStateException is expected
		}
	}

	private DefaultExecutionSlotAllocator createExecutionSlotAllocator() {
		return createExecutionSlotAllocator(new TestingInputsLocationsRetriever.Builder().build());
	}

	private DefaultExecutionSlotAllocator createExecutionSlotAllocator(InputsLocationsRetriever inputsLocationsRetriever) {
		return new DefaultExecutionSlotAllocator(
			SlotProviderStrategy.from(
				ScheduleMode.EAGER,
				slotProvider,
				Time.seconds(10),
				true),
			inputsLocationsRetriever);
	}

	private List<ExecutionVertexSchedulingRequirements> createSchedulingRequirements(ExecutionVertexID... executionVertexIds) {
		List<ExecutionVertexSchedulingRequirements> schedulingRequirements = new ArrayList<>(executionVertexIds.length);

		for (ExecutionVertexID executionVertexId : executionVertexIds) {
			schedulingRequirements.add(new ExecutionVertexSchedulingRequirements.Builder()
					.withExecutionVertexId(executionVertexId).build());
		}
		return schedulingRequirements;
	}

	private SlotExecutionVertexAssignment findSlotAssignmentByExecutionVertexId(
			ExecutionVertexID executionVertexId,
			Collection<SlotExecutionVertexAssignment> slotExecutionVertexAssignments) {
		return slotExecutionVertexAssignments.stream()
				.filter(slotExecutionVertexAssignment -> slotExecutionVertexAssignment.getExecutionVertexId().equals(executionVertexId))
				.findFirst()
				.orElseThrow(() -> new IllegalArgumentException(String.format(
						"SlotExecutionVertexAssignment with execution vertex id %s not found",
						executionVertexId)));
	}

	private static class AllocationToggableSlotProvider implements SlotProvider {

		private final List<Tuple3<SlotRequestId, ScheduledUnit, SlotProfile>> slotAllocationRequests = new ArrayList<>();

		private final List<SlotRequestId> cancelledSlotRequestIds = new ArrayList<>();

		private boolean slotAllocationDisabled;

		@Override
		public CompletableFuture<LogicalSlot> allocateSlot(
				SlotRequestId slotRequestId,
				ScheduledUnit task,
				SlotProfile slotProfile,
				boolean allowQueued,
				Time timeout) {

			slotAllocationRequests.add(Tuple3.of(slotRequestId, task, slotProfile));
			if (slotAllocationDisabled) {
				return new CompletableFuture<>();
			} else {
				return CompletableFuture.completedFuture(new TestingLogicalSlotBuilder().createTestingLogicalSlot());
			}
		}

		@Override
		public void cancelSlotRequest(
				final SlotRequestId slotRequestId,
				@Nullable final SlotSharingGroupId slotSharingGroupId,
				final Throwable cause) {
			cancelledSlotRequestIds.add(slotRequestId);
		}

		public List<Tuple3<SlotRequestId, ScheduledUnit, SlotProfile>> getSlotAllocationRequests() {
			return Collections.unmodifiableList(slotAllocationRequests);
		}

		public List<SlotRequestId> getReceivedSlotRequestIds() {
			return slotAllocationRequests.stream()
					.map(requestTuple -> requestTuple.f0)
					.collect(Collectors.toList());
		}

		public List<SlotRequestId> getCancelledSlotRequestIds() {
			return Collections.unmodifiableList(cancelledSlotRequestIds);
		}

		public void disableSlotAllocation() {
			slotAllocationDisabled = true;
		}
	}
}


text:
using System.Collections;
using System.Collections.Generic;

namespace Elasticsearch.Net.Connection.Thrift.Collections
{
	public class THashSet<T> : ICollection<T>
	{
#if NET_2_0
		TDictSet<T> set = new TDictSet<T>();
#else
		private readonly HashSet<T> set = new HashSet<T>();
#endif

		public int Count
		{
			get { return set.Count; }
		}

		public bool IsReadOnly
		{
			get { return false; }
		}

		public void Add(T item)
		{
			set.Add(item);
		}

		public void Clear()
		{
			set.Clear();
		}

		public bool Contains(T item)
		{
			return set.Contains(item);
		}

		public void CopyTo(T[] array, int arrayIndex)
		{
			set.CopyTo(array, arrayIndex);
		}

		public IEnumerator GetEnumerator()
		{
			return set.GetEnumerator();
		}

		IEnumerator<T> IEnumerable<T>.GetEnumerator()
		{
			return ((IEnumerable<T>) set).GetEnumerator();
		}

		public bool Remove(T item)
		{
			return set.Remove(item);
		}

#if NET_2_0
		private class TDictSet<V> : ICollection<V>
		{
			Dictionary<V, TDictSet<V>> dict = new Dictionary<V, TDictSet<V>>();

			public int Count
			{
				get { return dict.Count; }
			}

			public bool IsReadOnly
			{
				get { return false; }
			}

			public IEnumerator GetEnumerator()
			{
				return ((IEnumerable)dict.Keys).GetEnumerator();
			}

			IEnumerator<V> IEnumerable<V>.GetEnumerator()
			{
				return dict.Keys.GetEnumerator();
			}

			public bool Add(V item)
			{
				if (!dict.ContainsKey(item))
				{
					dict[item] = this;
					return true;
				}

				return false;
			}

			void ICollection<V>.Add(V item)
			{
				Add(item);
			}

			public void Clear()
			{
				dict.Clear();
			}

			public bool Contains(V item)
			{
				return dict.ContainsKey(item);
			}

			public void CopyTo(V[] array, int arrayIndex)
			{
				dict.Keys.CopyTo(array, arrayIndex);
			}

			public bool Remove(V item)
			{
				return dict.Remove(item);
			}
		}
#endif
	}
}


text:
import * as React from 'react'
import { storiesOf } from '@storybook/react'
import { action } from '@storybook/addon-actions';

import UpDefaultTheme from '../../../Common/theming'
import { ThemeProvider as UpThemeProvider } from '../../../Common/theming/themedComponents'

import UpBadge from './'

import UpBox from '../../Containers/Box'

console.log(UpDefaultTheme) ;

storiesOf('UpBadge', module)
  .addWithInfo('Simple usage', 'Utilisation du composant en lui passant les données à afficher',
   () => (
    <UpThemeProvider theme={UpDefaultTheme}>
      <UpBox style={{margin:'30px'}}>
        <UpBadge text="1" rounded={true} intent="primary" />
        <UpBadge text="2" rounded={true} intent="info" />
        <UpBadge text="3" rounded={true} intent="default" />
        <UpBadge text="4" rounded={true} intent="warning" />
        <UpBadge text="5" rounded={true} intent="danger" />
      </UpBox>
    </UpThemeProvider>
  )) ;


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.anarres.tftp.server.netty;

import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.ReferenceCountUtil;
import javax.annotation.Nonnull;
import org.anarres.tftp.protocol.engine.TftpTransfer;
import org.anarres.tftp.protocol.packet.TftpErrorCode;
import org.anarres.tftp.protocol.packet.TftpErrorPacket;
import org.anarres.tftp.protocol.packet.TftpPacket;
import org.anarres.tftp.protocol.packet.TftpRequestPacket;
import org.anarres.tftp.protocol.resource.TftpData;
import org.anarres.tftp.protocol.resource.TftpDataProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author shevek
 */
public class TftpServerHandler extends ChannelInboundHandlerAdapter {

    private static final Logger LOG = LoggerFactory.getLogger(TftpServerHandler.class);
    private final TftpPipelineInitializer.SharedHandlers sharedHandlers;
    private final TftpDataProvider provider;

    public TftpServerHandler(@Nonnull TftpPipelineInitializer.SharedHandlers sharedHandlers, @Nonnull TftpDataProvider provider) {
        this.sharedHandlers = sharedHandlers;
        this.provider = provider;
    }

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        try {
            final TftpPacket packet = (TftpPacket) msg;
            Channel channel = ctx.channel();

            switch (packet.getOpcode()) {
                case RRQ: {
                    TftpRequestPacket request = (TftpRequestPacket) packet;
                    TftpData source = provider.open(request.getFilename());
                    if (source == null) {
                        ctx.writeAndFlush(new TftpErrorPacket(packet.getRemoteAddress(), TftpErrorCode.FILE_NOT_FOUND), ctx.voidPromise());
                        // ctx.writeAndFlush(new TftpErrorPacket(packet.getRemoteAddress(), TftpErrorCode.FILE_NOT_FOUND)).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
                    } else {
                        TftpTransfer<Channel> transfer = new TftpReadTransfer(packet.getRemoteAddress(), source, request.getBlockSize());
                        Bootstrap bootstrap = new Bootstrap()
                                .group(ctx.channel().eventLoop())
                                .channel(channel.getClass())
                                // .localAddress(new InetSocketAddress(0))
                                // .remoteAddress(packet.getRemoteAddress())
                                .handler(new TftpPipelineInitializer(sharedHandlers, new TftpTransferHandler(transfer)));
                        bootstrap.connect(packet.getRemoteAddress());/*.addListener(new ChannelFutureListener() {
                         @Override
                         public void operationComplete(ChannelFuture future) throws Exception {
                         LOG.info("Connected for " + packet);
                         }
                         });*/

                    }
                    break;
                }
                case WRQ: {
                    // LOG.warn("Unexpected TFTP " + packet.getOpcode() + " packet: " + packet);
                    ctx.writeAndFlush(new TftpErrorPacket(packet.getRemoteAddress(), TftpErrorCode.PERMISSION_DENIED), ctx.voidPromise());
                    break;
                }
                case ACK: {
                    break;
                }
                case DATA: {
                    LOG.warn("Unexpected TFTP " + packet.getOpcode() + " packet: " + packet);
                    ctx.writeAndFlush(new TftpErrorPacket(packet.getRemoteAddress(), TftpErrorCode.ILLEGAL_OPERATION), ctx.voidPromise());
                    break;
                }
                case ERROR: {
                    LOG.error("Received TFTP error packet: {}", packet);
                    break;
                }
                default: {
                    LOG.error("Received unknown TFTP packet: {}", packet);
                    break;
                }
            }

        } catch (Exception e) {
            ctx.fireExceptionCaught(e);
            throw e;
        } finally {
            ReferenceCountUtil.release(msg);
        }
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
        ctx.flush();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
        LOG.error("Error on channel: " + cause, cause);
        // LOG.error("Reported here: " + cause, new Exception("Here"));
    }
}