text:
<?php

namespace DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement;

use DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement;
use DCarbone\PHPFHIRGenerated\DSTU1\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\DSTU1\PHPFHIRTypeInterface;

/**
 * For referring to data content defined in other formats.
 * If the element is present, it must have a value for at least one of the defined
 * elements, an \@id referenced from the Narrative, or extensions
 *
 * Class FHIRAttachment
 * @package \DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement
 */
class FHIRAttachment extends FHIRElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_ATTACHMENT;
    const FIELD_CONTENT_TYPE = 'contentType';
    const FIELD_CONTENT_TYPE_EXT = '_contentType';
    const FIELD_DATA = 'data';
    const FIELD_DATA_EXT = '_data';
    const FIELD_HASH = 'hash';
    const FIELD_HASH_EXT = '_hash';
    const FIELD_LANGUAGE = 'language';
    const FIELD_LANGUAGE_EXT = '_language';
    const FIELD_SIZE = 'size';
    const FIELD_SIZE_EXT = '_size';
    const FIELD_TITLE = 'title';
    const FIELD_TITLE_EXT = '_title';
    const FIELD_URL = 'url';
    const FIELD_URL_EXT = '_url';

    /** @var string */
    private $_xmlns = 'http://hl7.org/fhir';

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Identifies the type of the data in the attachment and allows a method to be
     * chosen to interpret or render the data. Includes mime type parameters such as
     * charset where appropriate.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode
     */
    protected $contentType = null;

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The actual data of the attachment - a sequence of bytes. In XML, represented
     * using base64.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary
     */
    protected $data = null;

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The calculated hash of the data using SHA-1. Represented using base64.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary
     */
    protected $hash = null;

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The human language of the content. The value can be any valid value according to
     * BCP 47.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode
     */
    protected $language = null;

    /**
     * A whole number
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The number of bytes of data that make up this attachment.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRInteger
     */
    protected $size = null;

    /**
     * A sequence of Unicode characters
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A label or set of text to display in place of the data.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRString
     */
    protected $title = null;

    /**
     * String of characters used to identify a name or a resource
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An alternative location where the data can be accessed.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRUri
     */
    protected $url = null;

    /**
     * Validation map for fields in type Attachment
     * @var array
     */
    private static $_validationRules = [    ];

    /**
     * FHIRAttachment Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIRAttachment::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_CONTENT_TYPE]) || isset($data[self::FIELD_CONTENT_TYPE_EXT])) {
            if (isset($data[self::FIELD_CONTENT_TYPE])) {
                $value = $data[self::FIELD_CONTENT_TYPE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_CONTENT_TYPE_EXT]) && is_array($data[self::FIELD_CONTENT_TYPE_EXT])) {
                $ext = $data[self::FIELD_CONTENT_TYPE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRCode) {
                    $this->setContentType($value);
                } else if (is_array($value)) {
                    $this->setContentType(new FHIRCode(array_merge($ext, $value)));
                } else {
                    $this->setContentType(new FHIRCode([FHIRCode::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setContentType(new FHIRCode($ext));
            }
        }
        if (isset($data[self::FIELD_DATA]) || isset($data[self::FIELD_DATA_EXT])) {
            if (isset($data[self::FIELD_DATA])) {
                $value = $data[self::FIELD_DATA];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_DATA_EXT]) && is_array($data[self::FIELD_DATA_EXT])) {
                $ext = $data[self::FIELD_DATA_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRBase64Binary) {
                    $this->setData($value);
                } else if (is_array($value)) {
                    $this->setData(new FHIRBase64Binary(array_merge($ext, $value)));
                } else {
                    $this->setData(new FHIRBase64Binary([FHIRBase64Binary::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setData(new FHIRBase64Binary($ext));
            }
        }
        if (isset($data[self::FIELD_HASH]) || isset($data[self::FIELD_HASH_EXT])) {
            if (isset($data[self::FIELD_HASH])) {
                $value = $data[self::FIELD_HASH];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_HASH_EXT]) && is_array($data[self::FIELD_HASH_EXT])) {
                $ext = $data[self::FIELD_HASH_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRBase64Binary) {
                    $this->setHash($value);
                } else if (is_array($value)) {
                    $this->setHash(new FHIRBase64Binary(array_merge($ext, $value)));
                } else {
                    $this->setHash(new FHIRBase64Binary([FHIRBase64Binary::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setHash(new FHIRBase64Binary($ext));
            }
        }
        if (isset($data[self::FIELD_LANGUAGE]) || isset($data[self::FIELD_LANGUAGE_EXT])) {
            if (isset($data[self::FIELD_LANGUAGE])) {
                $value = $data[self::FIELD_LANGUAGE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_LANGUAGE_EXT]) && is_array($data[self::FIELD_LANGUAGE_EXT])) {
                $ext = $data[self::FIELD_LANGUAGE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRCode) {
                    $this->setLanguage($value);
                } else if (is_array($value)) {
                    $this->setLanguage(new FHIRCode(array_merge($ext, $value)));
                } else {
                    $this->setLanguage(new FHIRCode([FHIRCode::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setLanguage(new FHIRCode($ext));
            }
        }
        if (isset($data[self::FIELD_SIZE]) || isset($data[self::FIELD_SIZE_EXT])) {
            if (isset($data[self::FIELD_SIZE])) {
                $value = $data[self::FIELD_SIZE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_SIZE_EXT]) && is_array($data[self::FIELD_SIZE_EXT])) {
                $ext = $data[self::FIELD_SIZE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRInteger) {
                    $this->setSize($value);
                } else if (is_array($value)) {
                    $this->setSize(new FHIRInteger(array_merge($ext, $value)));
                } else {
                    $this->setSize(new FHIRInteger([FHIRInteger::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setSize(new FHIRInteger($ext));
            }
        }
        if (isset($data[self::FIELD_TITLE]) || isset($data[self::FIELD_TITLE_EXT])) {
            if (isset($data[self::FIELD_TITLE])) {
                $value = $data[self::FIELD_TITLE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_TITLE_EXT]) && is_array($data[self::FIELD_TITLE_EXT])) {
                $ext = $data[self::FIELD_TITLE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setTitle($value);
                } else if (is_array($value)) {
                    $this->setTitle(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setTitle(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setTitle(new FHIRString($ext));
            }
        }
        if (isset($data[self::FIELD_URL]) || isset($data[self::FIELD_URL_EXT])) {
            if (isset($data[self::FIELD_URL])) {
                $value = $data[self::FIELD_URL];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_URL_EXT]) && is_array($data[self::FIELD_URL_EXT])) {
                $ext = $data[self::FIELD_URL_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRUri) {
                    $this->setUrl($value);
                } else if (is_array($value)) {
                    $this->setUrl(new FHIRUri(array_merge($ext, $value)));
                } else {
                    $this->setUrl(new FHIRUri([FHIRUri::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setUrl(new FHIRUri($ext));
            }
        }
    }

    /**
     * @return string
     */
    public function _getFHIRTypeName()
    {
        return self::FHIR_TYPE_NAME;
    }

    /**
     * @return string
     */
    public function _getFHIRXMLElementDefinition()
    {
        $xmlns = $this->_getFHIRXMLNamespace();
        if (null !== $xmlns) {
            $xmlns = " xmlns=\"{$xmlns}\"";
        }
        return "<Attachment{$xmlns}></Attachment>";
    }

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Identifies the type of the data in the attachment and allows a method to be
     * chosen to interpret or render the data. Includes mime type parameters such as
     * charset where appropriate.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode
     */
    public function getContentType()
    {
        return $this->contentType;
    }

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Identifies the type of the data in the attachment and allows a method to be
     * chosen to interpret or render the data. Includes mime type parameters such as
     * charset where appropriate.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode $contentType
     * @return static
     */
    public function setContentType($contentType = null)
    {
        if (null === $contentType) {
            $this->contentType = null;
            return $this;
        }
        if ($contentType instanceof FHIRCode) {
            $this->contentType = $contentType;
            return $this;
        }
        $this->contentType = new FHIRCode($contentType);
        return $this;
    }

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The actual data of the attachment - a sequence of bytes. In XML, represented
     * using base64.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary
     */
    public function getData()
    {
        return $this->data;
    }

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The actual data of the attachment - a sequence of bytes. In XML, represented
     * using base64.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary $data
     * @return static
     */
    public function setData($data = null)
    {
        if (null === $data) {
            $this->data = null;
            return $this;
        }
        if ($data instanceof FHIRBase64Binary) {
            $this->data = $data;
            return $this;
        }
        $this->data = new FHIRBase64Binary($data);
        return $this;
    }

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The calculated hash of the data using SHA-1. Represented using base64.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary
     */
    public function getHash()
    {
        return $this->hash;
    }

    /**
     * A stream of bytes
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The calculated hash of the data using SHA-1. Represented using base64.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRBase64Binary $hash
     * @return static
     */
    public function setHash($hash = null)
    {
        if (null === $hash) {
            $this->hash = null;
            return $this;
        }
        if ($hash instanceof FHIRBase64Binary) {
            $this->hash = $hash;
            return $this;
        }
        $this->hash = new FHIRBase64Binary($hash);
        return $this;
    }

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The human language of the content. The value can be any valid value according to
     * BCP 47.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode
     */
    public function getLanguage()
    {
        return $this->language;
    }

    /**
     * A string which has at least one character and no leading or trailing whitespace
     * and where there is no whitespace other than single spaces in the contents
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The human language of the content. The value can be any valid value according to
     * BCP 47.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRCode $language
     * @return static
     */
    public function setLanguage($language = null)
    {
        if (null === $language) {
            $this->language = null;
            return $this;
        }
        if ($language instanceof FHIRCode) {
            $this->language = $language;
            return $this;
        }
        $this->language = new FHIRCode($language);
        return $this;
    }

    /**
     * A whole number
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The number of bytes of data that make up this attachment.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRInteger
     */
    public function getSize()
    {
        return $this->size;
    }

    /**
     * A whole number
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The number of bytes of data that make up this attachment.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRInteger $size
     * @return static
     */
    public function setSize($size = null)
    {
        if (null === $size) {
            $this->size = null;
            return $this;
        }
        if ($size instanceof FHIRInteger) {
            $this->size = $size;
            return $this;
        }
        $this->size = new FHIRInteger($size);
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A label or set of text to display in place of the data.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRString
     */
    public function getTitle()
    {
        return $this->title;
    }

    /**
     * A sequence of Unicode characters
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * A label or set of text to display in place of the data.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRString $title
     * @return static
     */
    public function setTitle($title = null)
    {
        if (null === $title) {
            $this->title = null;
            return $this;
        }
        if ($title instanceof FHIRString) {
            $this->title = $title;
            return $this;
        }
        $this->title = new FHIRString($title);
        return $this;
    }

    /**
     * String of characters used to identify a name or a resource
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An alternative location where the data can be accessed.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRUri
     */
    public function getUrl()
    {
        return $this->url;
    }

    /**
     * String of characters used to identify a name or a resource
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An alternative location where the data can be accessed.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRUri $url
     * @return static
     */
    public function setUrl($url = null)
    {
        if (null === $url) {
            $this->url = null;
            return $this;
        }
        if ($url instanceof FHIRUri) {
            $this->url = $url;
            return $this;
        }
        $this->url = new FHIRUri($url);
        return $this;
    }

    /**
     * Returns the validation rules that this type's fields must comply with to be considered "valid"
     * The returned array is in ["fieldname[.offset]" => ["rule" => {constraint}]]
     *
     * @return array
     */
    public function _getValidationRules()
    {
        return self::$_validationRules;
    }

    /**
     * Validates that this type conforms to the specifications set forth for it by FHIR.  An empty array must be seen as
     * passing.
     *
     * @return array
     */
    public function _getValidationErrors()
    {
        $errs = parent::_getValidationErrors();
        $validationRules = $this->_getValidationRules();
        if (null !== ($v = $this->getContentType())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_CONTENT_TYPE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getData())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_DATA] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getHash())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_HASH] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getLanguage())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_LANGUAGE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getSize())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_SIZE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getTitle())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_TITLE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getUrl())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_URL] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_CONTENT_TYPE])) {
            $v = $this->getContentType();
            foreach($validationRules[self::FIELD_CONTENT_TYPE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_CONTENT_TYPE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_CONTENT_TYPE])) {
                        $errs[self::FIELD_CONTENT_TYPE] = [];
                    }
                    $errs[self::FIELD_CONTENT_TYPE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_DATA])) {
            $v = $this->getData();
            foreach($validationRules[self::FIELD_DATA] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_DATA, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DATA])) {
                        $errs[self::FIELD_DATA] = [];
                    }
                    $errs[self::FIELD_DATA][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_HASH])) {
            $v = $this->getHash();
            foreach($validationRules[self::FIELD_HASH] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_HASH, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_HASH])) {
                        $errs[self::FIELD_HASH] = [];
                    }
                    $errs[self::FIELD_HASH][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_LANGUAGE])) {
            $v = $this->getLanguage();
            foreach($validationRules[self::FIELD_LANGUAGE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_LANGUAGE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_LANGUAGE])) {
                        $errs[self::FIELD_LANGUAGE] = [];
                    }
                    $errs[self::FIELD_LANGUAGE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_SIZE])) {
            $v = $this->getSize();
            foreach($validationRules[self::FIELD_SIZE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_SIZE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_SIZE])) {
                        $errs[self::FIELD_SIZE] = [];
                    }
                    $errs[self::FIELD_SIZE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_TITLE])) {
            $v = $this->getTitle();
            foreach($validationRules[self::FIELD_TITLE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_TITLE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_TITLE])) {
                        $errs[self::FIELD_TITLE] = [];
                    }
                    $errs[self::FIELD_TITLE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_URL])) {
            $v = $this->getUrl();
            foreach($validationRules[self::FIELD_URL] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ATTACHMENT, self::FIELD_URL, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_URL])) {
                        $errs[self::FIELD_URL] = [];
                    }
                    $errs[self::FIELD_URL][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_EXTENSION])) {
            $v = $this->getExtension();
            foreach($validationRules[self::FIELD_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_EXTENSION])) {
                        $errs[self::FIELD_EXTENSION] = [];
                    }
                    $errs[self::FIELD_EXTENSION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_ID])) {
            $v = $this->getId();
            foreach($validationRules[self::FIELD_ID] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT, self::FIELD_ID, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_ID])) {
                        $errs[self::FIELD_ID] = [];
                    }
                    $errs[self::FIELD_ID][$rule] = $err;
                }
            }
        }
        return $errs;
    }

    /**
     * @param \SimpleXMLElement|string|null $sxe
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRAttachment $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRAttachment
     */
    public static function xmlUnserialize($sxe = null, PHPFHIRTypeInterface $type = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            return null;
        }
        if (is_string($sxe)) {
            libxml_use_internal_errors(true);
            $sxe = new \SimpleXMLElement($sxe, $libxmlOpts, false);
            if ($sxe === false) {
                throw new \DomainException(sprintf('FHIRAttachment::xmlUnserialize - String provided is not parseable as XML: %s', implode(', ', array_map(function(\libXMLError $err) { return $err->message; }, libxml_get_errors()))));
            }
            libxml_use_internal_errors(false);
        }
        if (!($sxe instanceof \SimpleXMLElement)) {
            throw new \InvalidArgumentException(sprintf('FHIRAttachment::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIRAttachment;
        } elseif (!is_object($type) || !($type instanceof FHIRAttachment)) {
            throw new \RuntimeException(sprintf(
                'FHIRAttachment::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\DSTU1\FHIRElement\FHIRAttachment or null, %s seen.',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }
        FHIRElement::xmlUnserialize($sxe, $type);
        $xmlNamespaces = $sxe->getDocNamespaces(false, false);
        if ([] !== $xmlNamespaces) {
            $ns = reset($xmlNamespaces);
            if (false !== $ns && '' !== $ns) {
                $type->_xmlns = $ns;
            }
        }
        $attributes = $sxe->attributes();
        $children = $sxe->children();
        if (isset($children->contentType)) {
            $type->setContentType(FHIRCode::xmlUnserialize($children->contentType));
        }
        if (isset($attributes->contentType)) {
            $pt = $type->getContentType();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->contentType);
            } else {
                $type->setContentType((string)$attributes->contentType);
            }
        }
        if (isset($children->data)) {
            $type->setData(FHIRBase64Binary::xmlUnserialize($children->data));
        }
        if (isset($attributes->data)) {
            $pt = $type->getData();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->data);
            } else {
                $type->setData((string)$attributes->data);
            }
        }
        if (isset($children->hash)) {
            $type->setHash(FHIRBase64Binary::xmlUnserialize($children->hash));
        }
        if (isset($attributes->hash)) {
            $pt = $type->getHash();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->hash);
            } else {
                $type->setHash((string)$attributes->hash);
            }
        }
        if (isset($children->language)) {
            $type->setLanguage(FHIRCode::xmlUnserialize($children->language));
        }
        if (isset($attributes->language)) {
            $pt = $type->getLanguage();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->language);
            } else {
                $type->setLanguage((string)$attributes->language);
            }
        }
        if (isset($children->size)) {
            $type->setSize(FHIRInteger::xmlUnserialize($children->size));
        }
        if (isset($attributes->size)) {
            $pt = $type->getSize();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->size);
            } else {
                $type->setSize((string)$attributes->size);
            }
        }
        if (isset($children->title)) {
            $type->setTitle(FHIRString::xmlUnserialize($children->title));
        }
        if (isset($attributes->title)) {
            $pt = $type->getTitle();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->title);
            } else {
                $type->setTitle((string)$attributes->title);
            }
        }
        if (isset($children->url)) {
            $type->setUrl(FHIRUri::xmlUnserialize($children->url));
        }
        if (isset($attributes->url)) {
            $pt = $type->getUrl();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->url);
            } else {
                $type->setUrl((string)$attributes->url);
            }
        }
        return $type;
    }

    /**
     * @param null|\SimpleXMLElement $sxe
     * @param null|int $libxmlOpts
     * @return \SimpleXMLElement
     */
    public function xmlSerialize(\SimpleXMLElement $sxe = null, $libxmlOpts = 591872)
    {
        if (null === $sxe) {
            $sxe = new \SimpleXMLElement($this->_getFHIRXMLElementDefinition(), $libxmlOpts, false);
        }
        parent::xmlSerialize($sxe);
        if (null !== ($v = $this->getContentType())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_CONTENT_TYPE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getData())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_DATA, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getHash())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_HASH, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getLanguage())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_LANGUAGE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getSize())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_SIZE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getTitle())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_TITLE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getUrl())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_URL, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getContentType())) {
            $a[self::FIELD_CONTENT_TYPE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRCode::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRCode::FIELD_VALUE]);
                $a[self::FIELD_CONTENT_TYPE_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getData())) {
            $a[self::FIELD_DATA] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRBase64Binary::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRBase64Binary::FIELD_VALUE]);
                $a[self::FIELD_DATA_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getHash())) {
            $a[self::FIELD_HASH] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRBase64Binary::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRBase64Binary::FIELD_VALUE]);
                $a[self::FIELD_HASH_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getLanguage())) {
            $a[self::FIELD_LANGUAGE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRCode::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRCode::FIELD_VALUE]);
                $a[self::FIELD_LANGUAGE_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getSize())) {
            $a[self::FIELD_SIZE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRInteger::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRInteger::FIELD_VALUE]);
                $a[self::FIELD_SIZE_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getTitle())) {
            $a[self::FIELD_TITLE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRString::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRString::FIELD_VALUE]);
                $a[self::FIELD_TITLE_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getUrl())) {
            $a[self::FIELD_URL] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRUri::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRUri::FIELD_VALUE]);
                $a[self::FIELD_URL_EXT] = $enc;
            }
        }
        if ([] !== ($vs = $this->_getFHIRComments())) {
            $a[PHPFHIRConstants::JSON_FIELD_FHIR_COMMENTS] = $vs;
        }
        return $a;
    }

    /**
     * @return string
     */
    public function __toString()
    {
        return self::FHIR_TYPE_NAME;
    }
}


text:
import type { IColorAnimation } from "../../Interfaces/Particles/IColorAnimation";
import type { RecursivePartial } from "../../../Types/RecursivePartial";
import type { IOptionLoader } from "../../Interfaces/IOptionLoader";
export declare class ColorAnimation implements IColorAnimation, IOptionLoader<IColorAnimation> {
    enable: boolean;
    speed: number;
    sync: boolean;
    constructor();
    load(data?: RecursivePartial<IColorAnimation>): void;
}

redpajama_set_name: RedPajamaGithub


text:
/* AnythingZoomer */
.az-wrap, .az-small, .az-large {
	position: relative;
}
.az-wrap-inner {
	display: block;
}
/* This wraps the large image and hides it */
.az-zoom {
	background: #fff;
	border: #333 1px solid;
	position: absolute;
	top: 0;
	left: 0;
	width: 110px;
	height: 110px;
	overflow: hidden;
	z-index: 100;
	display: none;
	-moz-box-shadow: inset 0px 0px 4px #000;
	-webkit-box-shadow: inset 0px 0px 4px #000;
	box-shadow: inset 0px 0px 4px #000;
}
/* Class applied to az-mover when large image is windowed */
.az-windowed {
	overflow: hidden;
	position: absolute;
}
/* Class applied to az-mover when large image is fully shown */
.az-expanded {
	height: auto;
	width: auto;
	position: static;
	overflow: visible;
};


text:
/* $NetBSD: if_pppoe.h,v 1.3 2002/04/14 12:24:28 martin Exp $ */

/*-
 * Copyright (c) 2002 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Martin Husemann <martin@netbsd.org>.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *        This product includes software developed by the NetBSD
 *        Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

struct pppoediscparms {
	char	ifname[IFNAMSIZ];	/* pppoe interface name */
	char	eth_ifname[IFNAMSIZ];	/* external ethernet interface name */
	char	*ac_name;		/* access concentrator name (or NULL) */
	size_t	ac_name_len;		/* on write: length of buffer for ac_name */
	char	*service_name;		/* service name (or NULL) */
	size_t	service_name_len;	/* on write: length of buffer for service name */
};

#define	PPPOESETPARMS	_IOW('i', 110, struct pppoediscparms)
#define	PPPOEGETPARMS	_IOWR('i', 111, struct pppoediscparms)

#define PPPOE_STATE_INITIAL	0
#define PPPOE_STATE_PADI_SENT	1
#define	PPPOE_STATE_PADR_SENT	2
#define	PPPOE_STATE_SESSION	3
#define	PPPOE_STATE_CLOSING	4

struct pppoeconnectionstate {
	char	ifname[IFNAMSIZ];	/* pppoe interface name */
	u_int	state;			/* one of the PPPOE_STATE_ states above */
	u_int	session_id;		/* if state == PPPOE_STATE_SESSION */
	u_int	padi_retry_no;		/* number of retries already sent */
	u_int	padr_retry_no;
};

#define PPPOEGETSESSION	_IOWR('i', 112, struct pppoeconnectionstate)

struct pppoeidletimeoutcfg {
	char	ifname[IFNAMSIZ];	/* pppoe interface name */
	u_long	idle_timeout;		/* idle timeout in seconds */
};

#define	PPPOEGETIDLETIMEOUT	_IOWR('i', 113, struct pppoeidletimeoutcfg)
#define	PPPOESETIDLETIMEOUT	_IOW('i', 114, struct pppoeidletimeoutcfg)

#ifdef _KERNEL

extern struct ifqueue ppoediscinq;
extern struct ifqueue ppoeinq;

#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
extern void * pppoe_softintr;			/* softinterrupt cookie */
#else
extern struct callout pppoe_softintr;		/* callout (poor mans softint) */
extern void pppoe_softintr_handler(void*);	/* handler function */
#endif

#endif	/* _KERNEL */


text:
import argparse, copy, numpy, random, yaml
import matplotlib.pyplot as plt

if __name__ == '__main__':

    parser = argparse.ArgumentParser(description="Plot the primitives in a primitives file")
    parser.add_argument('--filename', type=str, default='base_planner_parameters.yaml')

    args = parser.parse_args()

    with open(args.filename, 'r') as f:
        doc = yaml.load(f.read())

    actions = doc['actions']
    for angle in actions:
        ang = angle['angle']
        primitives = angle['primitives']
        xvals = []
        yvals = []
        tvals = []
	for primitive in primitives:
            poses = primitive['poses']
            for coord in poses:
                xvals.append(coord[0])
                yvals.append(coord[1])
                tvals.append(coord[2])

        plt.plot(xvals, yvals, '.b')
        title_str = 'Angle %d' % ang
        plt.title(title_str)
        plt.show()


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>TestIncrementingEnvironmentEdge xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />

View Javadoc

1
19  package org.apache.hadoop.hbase.util;
20
21  import org.apache.hadoop.hbase.MediumTests;
22  import org.apache.hadoop.hbase.SmallTests;
23  import org.junit.Test;
24  import org.junit.experimental.categories.Category;
25
26  import static junit.framework.Assert.assertEquals;
27
28  /**
29   * Tests that the incrementing environment edge increments time instead of using
30   * the default.
31   */
32  @Category(SmallTests.class)
33  public class TestIncrementingEnvironmentEdge {
34
35    @Test
36    public void testGetCurrentTimeUsesSystemClock() {
37      IncrementingEnvironmentEdge edge = new IncrementingEnvironmentEdge(1);
38      assertEquals(1, edge.currentTimeMillis());
39      assertEquals(2, edge.currentTimeMillis());
40      assertEquals(3, edge.currentTimeMillis());
41      assertEquals(4, edge.currentTimeMillis());
42    }
43
44  }
45

This page was automatically generated by Maven


text:
package :subversion, :provides => :scm do
  description 'Subversion Version Control'
  apt 'subversion'
end


text:
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<meta charset="utf-8">
<title>OSS_SNMP » \OSS_SNMP\Cache\Basic</title>
<meta name="author" content="Mike van Riel">
<meta name="description" content="">
<link href="../css/template.css" rel="stylesheet" media="all">
<link rel="shortcut icon" href="../img/favicon.ico">
<link rel="apple-touch-icon" href="../img/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="../img/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="../img/apple-touch-icon-114x114.png">

OSS_SNMP

                                    API Documentation

Namespaces

 OSS_SNMP

                                    Charts

 Class hierarchy diagram

                                    Reports

 Errors
                62

 Markers

 Deprecated elements
                2

Back to top

                            Javascript is disabled; several features are only available
                            if Javascript is enabled.

<button class="btn public active" title="Show public elements">Public</button><button class="btn protected" title="Show protected elements">Protected</button><button class="btn private" title="Show private elements">Private</button><button class="btn inherited active" title="Show inherited elements">Inherited</button>

<button class="btn details" title="Show descriptions and method names"></button><button class="btn simple" title="Show only method names"></button>

 Methods

Cache constructor.
__construct()

Clear a named value from the cache
clear()

Clear all values from the cache
clearAll()

Load a named value from the cache (or null if not present)
load()

Save a named value to the cache
save()

» Protected

clear()

clear()

clearAll()

clearAll()

load()

load()

save()

save()

 Properties

» Protected

$_cache

\

OSS_SNMP

\Cache

\Basic

basic (array) cache implementation

See the implementation in \OSS_SNMP\Cache\Basic for proper examples and documentation.

copyright
Copyright (c) 2012, Open Source Solutions Limited, Dublin, Ireland

author
Barry O'Donovan

 Methods

Cache constructor.

__construct() : \OSS_SNMP\Cache\Basic

For basic cache, takes no parameters.

Returns

\OSS_SNMP\Cache\BasicAn instance of the cache ($this) for  fluent interfaces

Clear a named value from the cache

clear(string $var)

Parameters

$var

string
The name of the value to clear

Clear all values from the cache

clearAll()

Load a named value from the cache (or null if not present)

load(string $var) : mixed | null

Parameters

$var

string
The name of the value to load

Returns

mixednullThe value from the cache or null

Save a named value to the cache

save(string $var, mixed $val) : mixed

Parameters

$var

string
The name of the value to save

$val

mixed
The value to save

Returns

mixedThe value (as passed)

clear()

clear($varName)

Parameters

$varName

clearAll()

clearAll()

load()

load($varName)

Parameters

$varName

save()

save($varName, $varValue)

Parameters

$varName

$varValue

 Properties

An array to store results - a temporary cache

$_cache : array

Default

            Template is built using Twitter Bootstrap 2 and icons provided by Glyphicons.

            Documentation is powered by phpDocumentor 2.4.0
 and

            generated on 2014-07-08T08:56:26+01:00.


text:
/**
 * Classes that represent named binary tags in an organized tree structure.
 */
package com.kovuthehusky.nbt.tags;


text:
@interface KMKeyboardHelpWindowController : NSWindowController

@property (nonatomic, strong) NSString *packagePath;

@end


text:
using Xunit;

// Some tests launch processes.  If other tests that run concurrently create inheritable pipes and the launched
// process inherits it, then the lifetime of those pipes will be extended beyond when the test expects, leading
// to failures due to naming conflicts and the like.  On Unix this can happen even for non-inheritable pipes, as they're
// made non-inheritable via CLOEXEC, but there's still a small window between the process being forked and that
// forked process calling exec where the handle remains open in the other process.
[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly, DisableTestParallelization = true, MaxParallelThreads = 1)]


text:
package cn.com.chenyixiao.designpattern.observer.version3;

public class StockObserver extends Observer {

	public StockObserver(String name, Subject sub) {
		super(name, sub);
	}

	public void CloseStockMarket() {
		System.out.println(sub.getSubjectState() + name + " 关闭股市行情, 继续工作!");
	}

}


text:
package com.linkedin.drelephant.schedulers;

import com.linkedin.drelephant.configurations.scheduler.SchedulerConfigurationData;
import java.util.Properties;
import org.apache.log4j.Logger;

/**
 * This class provides methods to load information specific to the Azkaban scheduler.
 */
public class AzkabanScheduler implements Scheduler {

  private static final Logger logger = Logger.getLogger(AzkabanScheduler.class);

  public static final String AZKABAN_WORKFLOW_URL = "azkaban.link.workflow.url";
  public static final String AZKABAN_JOB_URL = "azkaban.link.job.url";
  public static final String AZKABAN_EXECUTION_URL = "azkaban.link.execution.url";
  public static final String AZKABAN_ATTEMPT_URL = "azkaban.link.attempt.url";
  public static final String AZKABAN_JOB_NAME = "azkaban.job.id";

  private String schedulerName;
  private String jobDefId;
  private String jobExecId;
  private String flowDefId;
  private String flowExecId;

  private String jobDefUrl;
  private String jobExecUrl;
  private String flowDefUrl;
  private String flowExecUrl;

  private String jobName;
  private int workflowDepth;

  public AzkabanScheduler(String appId, Properties properties, SchedulerConfigurationData schedulerConfData) {
    schedulerName = schedulerConfData.getSchedulerName();
    if (properties != null) {
      loadInfo(appId, properties);
    } else {
      // Use default value of data type
    }
  }

  private void loadInfo(String appId, Properties properties) {
    // Update the 4 Ids
    jobDefId = properties.getProperty(AZKABAN_JOB_URL);
    jobExecId = properties.getProperty(AZKABAN_ATTEMPT_URL);
    flowDefId = properties.getProperty(AZKABAN_WORKFLOW_URL);
    flowExecId = properties.getProperty(AZKABAN_EXECUTION_URL);

    // For Azkaban, The url and ids are the same
    jobExecUrl = jobExecId;
    jobDefUrl = jobDefId;
    flowExecUrl = flowExecId;
    flowDefUrl = flowDefId;

    workflowDepth = 0; // TODO: Add sub-workflow support
    jobName = properties.getProperty(AZKABAN_JOB_NAME);
  }

  @Override
  public String getSchedulerName() {
    return schedulerName;
  }

  @Override
  public boolean isEmpty() {
    return jobDefId == null || jobExecId == null || flowDefId == null || flowExecId == null;
  }

  @Override
  public String getJobDefId() {
    return jobDefId;
  }

  @Override
  public String getJobExecId() {
    return jobExecId;
  }

  @Override
  public String getFlowDefId() {
    return flowDefId;
  }

  @Override
  public String getFlowExecId() {
    return flowExecId;
  }

  @Override
  public String getJobDefUrl() {
    return jobDefUrl;
  }

  @Override
  public String getJobExecUrl() {
    return jobExecUrl;
  }

  @Override
  public String getFlowDefUrl() {
    return flowDefUrl;
  }

  @Override
  public String getFlowExecUrl() {
    return flowExecUrl;
  }

  @Override
  public int getWorkflowDepth() {
    return workflowDepth;
  }

  @Override
  public String getJobName() {
    return jobName;
  }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeConverter.Test.Languages.CSharp
{
    public class Throw
    {
        public void Method()
        {
            throw new Exception("Hey");
        }
    }
}


text:
package com.sibvisions.rad.ui.javafx.ext.util;

import java.lang.reflect.Field;

import com.sun.javafx.scene.control.behavior.BehaviorBase;
import com.sun.javafx.scene.control.skin.BehaviorSkinBase;

/**
 * The {@link FXBehaviorInjector} is a helper utility that allows to inject a
 * {@link BehaviorBase} into a {@link BehaviorSkinBase} by using reflection.
 *

 * There are several skin classes that do not allow to set a custom behavior, so
 * it needs to be injected by using Reflection. However there are efforts to
 * make this obsolete,
 * RT-21598.
 *
 * @author Robert Zenz
 */
public final class FXBehaviorInjector
{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Initialization
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	/**
	 * No instance needed.
	 */
	private FXBehaviorInjector()
	{
		// No instance needed.
	}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// User-defined methods
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

	/**
	 * Injects the given {@link BehaviorBase behavior} into the given
	 * {@link BehaviorSkinBase skin} by using reflection.
	 *
	 * @param pSkin the {@link BehaviorSkinBase skin}.
	 * @param pBehavior the {@link BehaviorBase behavior} to inject.
	 */
	public static void inject(BehaviorSkinBase<?, ?> pSkin, BehaviorBase<?> pBehavior)
	{
		try
		{
			Field behaviorField = BehaviorSkinBase.class.getDeclaredField("behavior");
			behaviorField.setAccessible(true);

			// The old behavior needs to be properly disposed, otherwise
			// the new behavior will not work at all.
			BehaviorBase<?> oldBehavior = (BehaviorBase<?>)behaviorField.get(pSkin);
			oldBehavior.dispose();

			behaviorField.set(pSkin, pBehavior);
		}
		catch (Exception e)
		{
			// TODO Injection failed, should be inform the user/client?
			e.printStackTrace();
		}
	}

}	// FXBehaviorInjector


text:
/** -*- C++ -*-
    @file wibble/consumer.h
    @author Peter Rockai <me@mornfall.net>
*/

#include <iterator>

#include <wibble/amorph.h>
#include <wibble/range.h>
#include <wibble/cast.h>

#ifndef WIBBLE_CONSUMER_H
#define WIBBLE_CONSUMER_H

namespace wibble {

template< typename T > struct Consumer;

template< typename T >
struct ConsumerInterface
{
    typedef T InputType;
    virtual void consume( const T &a ) = 0;
    virtual void consume( Range< T > s ) = 0;
    virtual ~ConsumerInterface() {}
};

template< typename T, typename W >
struct ConsumerMorph : Morph< ConsumerMorph< T, W >, W, ConsumerInterface< T > >
{
    ConsumerMorph() {}
    ConsumerMorph( const W &w ) : Morph< ConsumerMorph, W, ConsumerInterface< T > >( w ) {}

    virtual void consume( const T &a ) {
        return this->wrapped().consume( a );
    }

    virtual void consume( Range< T > s ) {
        while ( !s.empty() ) {
            consume( s.head() );
            s = s.tail();
        }
    }
};

template< typename T, typename Self >
struct ConsumerMixin : mixin::Comparable< Self >
{
    Self &self() { return *static_cast< Self * >( this ); }
    const Self &self() const { return *static_cast< const Self * >( this ); }
    typedef std::output_iterator_tag iterator_category;
    typedef T ConsumedType;

    bool operator<=( const Self &o ) const { return this <= &o; }
    Consumer< T > &operator++() { return self(); }
    Consumer< T > &operator++(int) { return self(); }
    Consumer< T > &operator*() { return self(); }
    Consumer< T > &operator=( const T &a ) {
        self()->consume( a );
        return self();
    }
};

template< typename T >
struct Consumer: Amorph< Consumer< T >, ConsumerInterface< T > >,
                 ConsumerMixin< T, Consumer< T > >
{
    typedef Amorph< Consumer< T >, ConsumerInterface< T > > Super;

    typedef void value_type;
    typedef void difference_type;
    typedef void pointer;
    typedef void reference;

    Consumer( const MorphInterface< ConsumerInterface< T > > &i ) : Super( i ) {}
    Consumer() {}

    void consume( const T &a ) {
        return this->implementation()->consume( a );
    }

    Consumer< T > &operator=( const T &a ) {
        consume( a );
        return *this;
    }
    // output iterator - can't read or move
};

template< typename T, typename Out >
struct ConsumerFromIterator : ConsumerMixin< T, ConsumerFromIterator< T, Out > >
{
    ConsumerFromIterator( Out out ) : m_out( out ) {}
    void consume( const T& a ) {
        *(*m_out) = a;
        ++(*m_out);
    }
protected:
    Out m_out;
};

template< typename R >
Consumer< typename R::ConsumedType > consumerMorph( R r ) {
    return ConsumerMorph< typename R::ConsumedType , R >( r );
}

// insert iterators
template< typename Out >
Consumer< typename Out::container_type::value_type > consumer( Out out ) {
    return consumerMorph(
        ConsumerFromIterator< typename Out::container_type::value_type, Out >( out ) );
}

// containers
template< typename T >
typename IsType< Consumer< typename T::value_type >, typename T::iterator >::T consumer( T &c ) {
    return consumer( std::inserter( c, c.end() ) );
}

// consumers
template< typename T >
Consumer< T > consumer( const ConsumerInterface< T > &t ) {
    return t;
}

}

#endif


text:
package parser

import (
	"testing"

	. "github.com/smartystreets/goconvey/convey"
	"gopkg.in/sensorbee/sensorbee.v0/data"
)

func TestAssembleUpdateSource(t *testing.T) {
	Convey("Given a parseStack", t, func() {
		ps := parseStack{}
		Convey("When the stack contains the correct UPDATE SOURCE items", func() {
			ps.PushComponent(2, 4, StreamIdentifier("a"))
			ps.PushComponent(6, 8, SourceSinkParamAST{"c", data.String("d")})
			ps.PushComponent(8, 10, SourceSinkParamAST{"e", data.String("f")})
			ps.AssembleSourceSinkSpecs(6, 10)
			ps.AssembleUpdateSource()

			Convey("Then AssembleUpdateSource transforms them into one item", func() {
				So(ps.Len(), ShouldEqual, 1)

				Convey("And that item is a UpdateSourceStmt", func() {
					top := ps.Peek()
					So(top, ShouldNotBeNil)
					So(top.begin, ShouldEqual, 2)
					So(top.end, ShouldEqual, 10)
					So(top.comp, ShouldHaveSameTypeAs, UpdateSourceStmt{})

					Convey("And it contains the previously pushed data", func() {
						comp := top.comp.(UpdateSourceStmt)
						So(comp.Name, ShouldEqual, "a")
						So(len(comp.Params), ShouldEqual, 2)
						So(comp.Params[0].Key, ShouldEqual, "c")
						So(comp.Params[0].Value, ShouldEqual, data.String("d"))
						So(comp.Params[1].Key, ShouldEqual, "e")
						So(comp.Params[1].Value, ShouldEqual, data.String("f"))
					})
				})
			})
		})

		Convey("When the stack does not contain enough items", func() {
			ps.PushComponent(6, 7, RowValue{"", "a"})
			ps.AssembleProjections(6, 7)
			Convey("Then AssembleUpdateSource panics", func() {
				So(ps.AssembleUpdateSource, ShouldPanic)
			})
		})

		Convey("When the stack contains a wrong item", func() {
			ps.PushComponent(2, 4, Raw{"a"}) // must be StreamIdentifier
			ps.PushComponent(6, 8, SourceSinkParamAST{"c", data.String("d")})
			ps.PushComponent(8, 10, SourceSinkParamAST{"e", data.String("f")})
			ps.AssembleSourceSinkSpecs(6, 10)

			Convey("Then AssembleUpdateSource panics", func() {
				So(ps.AssembleUpdateSource, ShouldPanic)
			})
		})
	})

	Convey("Given a parser", t, func() {
		p := &bqlPeg{}

		Convey("When doing a full UPDATE SOURCE", func() {
			p.Buffer = `UPDATE SOURCE a_1 SET c=27, e_="f_1"`
			p.Init()

			Convey("Then the statement should be parsed correctly", func() {
				err := p.Parse()
				So(err, ShouldBeNil)
				p.Execute()

				ps := p.parseStack
				So(ps.Len(), ShouldEqual, 1)
				top := ps.Peek().comp
				So(top, ShouldHaveSameTypeAs, UpdateSourceStmt{})
				comp := top.(UpdateSourceStmt)

				So(comp.Name, ShouldEqual, "a_1")
				So(len(comp.Params), ShouldEqual, 2)
				So(comp.Params[0].Key, ShouldEqual, "c")
				So(comp.Params[0].Value, ShouldEqual, data.Int(27))
				So(comp.Params[1].Key, ShouldEqual, "e_")
				So(comp.Params[1].Value, ShouldEqual, data.String("f_1"))

				Convey("And String() should return the original statement", func() {
					So(comp.String(), ShouldEqual, p.Buffer)
				})
			})
		})
	})
}


text:
+++
template = "page.html"
title = "Frequently Asked Questions"
[extra]
navbar = "page"
+++

# Frequently Asked Questions

### How does topic selection work?

The topic selection process involves the MinneHack staff and MinneHack sponsors. The chosen topic will remain secret until it is announced during the keynote speech (6PM on February 2nd).

### How does team formation work?

There is no formal team formation process. Teams can be formed ahead of time or at the event; no formal ahead-of-time team registration is required. In the Discord server set up for the event, there will be a team formation channel to allow people who want teams or team members to find them.

### What type of project deliverable is expected? Is the deliverable a presentation about what you built, or is is just the thing that you built?

During primary judging (2:00PM-4:30PM on the 3rd), the judges will walk around and score projects. The top 10 teams or individuals are then notified that they've been selected for the final judging. They produce a presentation, which is presented to the judges and all competitors.

### Will we be allowed to talk to judges about our project in a two-way conversation?

Both primary and final judging are both fairly interactive; primary more so due to the smaller-scale interaction.

### Will there be multiple categories for prizes?

Yes! They will be announced at the event.

### Will the size of the team be considered (higher expectations for bigger teams)?

No. Furthermore, each team member receives the same prize an individual would if the team wins. Last year, the first, second, and third place competitors were all teams, so I'd advise teaming up!

### Your website says come with ideas.  Is there a general topic or theme, or is it anything?

There is a general topic, it will remain secret until it is announced during the keynote speech, February 2nd at 6:00pm. However, it is generally helpful to come with ideas of what you might like to do. Note that only work done during the event is eligible to be judged and win prizes.

### Is there a list of people who are looking for teammates, or any sort of built-in pairing mechanism?

There is not a list of people who are looking for teammates or any built in pairing mechanism. However, we will have a Discord server set up for the event with a channel specifically for people looking for teams or teammates.

# Travel Reimbursement FAQs:

### Will you be providing travel reimbursements this year?

**YES!** We are able to provide travel reimbursements. The application for travel reimbursement has been incorporated into the RSVP form this year. If you have not received an RSVP email yet, fear not. They are being sent out on a rolling basis based on when you register.

### Can I get reimbursement if I live outside the United States?

Unfortunately, no. We will need a US mailing address to send you the reimbursement. You can work around this if you have someone who lives in the United States and can receive mail for you, but their address needs to be the one you put on the travel reimbursement request.

### How much reimbursement can I receive?

Historically we have only given individuals up to $100 in reimbursement. We will consider reimbursement requests above this, but requests above $100 may not receive the full amount. We will be prioritising those with higher need for reimbursement as well as people who make an effort to lower the cost of travel.

### Do I need to request reimbursement if I plan on taking one of the busses you are sending?

Nope, we are covering all the costs for the busses we are sending. You only need to request reimbursement if you are taking a bus that we are not sending.

### Where are you sending busses?

We are still figuring out where we are sending busses this year. We will definitely be sending a bus to Madison, WI. We will likely be sending busses to Purdue, and the University of Illinous Urbana Champaign. If you are interested in being a bus captain, please contact us and let us know. If you are at Purdue or UIUC and would like us to confirm that we are sending a bus to you, please contact us.

### Am I guaranteed reimbursement?

No, we are not able to guarantee reimbursement until after the event is complete. To receive reimbursement you must attend the event and have a US mailing address. You must also request your reimbursement before the end of the event. Reimbursement requests that are sent sooner will be given higher priority than those sent later.

### By what criteria will you be approving the requests?

We will be prioritizing people who have higher need for reimbursement, as well as those who make a clear effort to lower the cost of travel. We are more likely to approve requests under $100, but will consider requests above it.

### How will I know if my request has been approved?

One week after MinneHack we will be emailing everyone whose request has been approved with the steps they need to follow to receive their reimbursement.

# Have more questions?

Reach us directly by email at [acm@umn.edu](mailto:acm@umn.edu)!


text:
package com.siyeh.igtest.security;

public class SystemPropertiesInspection
{
    public void foo()
    {
       System.getProperties();
       System.getProperty("foo");
       Integer.getInteger("foo");
       Boolean.getBoolean("foo");
    }
}


text:
package com.github.bachelorpraktikum.visualisierbar.model;

import javafx.collections.ObservableList;
import javax.annotation.Nonnull;

/**
 * Represents one or more events that happened at a specific point in time.
 */
public interface Event extends Comparable<Event> {

    /**
     * Gets the time this event occured.
     *
     * @return the time in milliseconds since simulation start
     */
    int getTime();

    /**
     * Gets a string representation of this event.
     *
     * @return a potentially human readable description
     */
    @Nonnull
    String getDescription();

    @Nonnull
    ObservableList<String> getWarnings();

    default int compareTo(@Nonnull Event other) {
        return Integer.compare(getTime(), other.getTime());
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ListView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"/><!-- From: file:/C:/Work/Studying/android/material-design-library/library/src/main/res/layout/mdl_listview.xml --><!-- From: file:/C:/Work/Studying/android/material-design-library/library/build/intermediates/bundles/debug/res/layout/mdl_listview.xml -->


text:
#ifndef PP_SYSTEM_UI_CONTROLS_MENU_MENUBAR_HPP
#define PP_SYSTEM_UI_CONTROLS_MENU_MENUBAR_HPP

namespace PP
{
    namespace System
    {
        namespace UI
        {
            class Menu;
            class MenuItem;

            class MenuBar
            {
            public:
                MenuBar();
                virtual ~MenuBar();
                void* getHandle() const;
                void append(Menu* menu);

                MenuItem* findItem(long id) const;

            private:
                HMENU m_handle;
                typedef std::vector<Menu*> MenuList;
                MenuList m_menuList;
            };
        }
    }
}

#endif


text:
var should = require('should');
var sinon = require('sinon');
var React = require('react');
var TestUtils = require('react-addons-test-utils');

var ga = require('../src/index');

var GLOBALS = ['ga', 'GoogleAnalyticsObject', 'window', 'document'];

describe('react-ga', function () {
  function getGaCalls() {
    var q = (window.ga && window.ga.q) || [];

    return q.map(function (args) {
      return [].slice.call(args);
    });
  }

  beforeEach(function () {
    sinon.stub(console, 'warn');
    sinon.stub(console, 'info');
    global.window = global;
    global.document = {
      createElement: function (name) {
        return {};
      },

      getElementsByTagName: function (name) {
        return [{
          parentNode: {
            insertBefore: function () {}
          }
        }];
      }
    };
  });

  afterEach(function () {
    console.warn.restore();
    console.info.restore();
    GLOBALS.forEach(function (name) {
      delete global[name];
    });
  });

  describe('initialize()', function () {
    it('should define window.ga', function () {
      ga.initialize('foo');
      (typeof window.ga).should.equal('function');
    });

    it('should call window.ga()', function () {
      ga.initialize('foo');
      getGaCalls().should.eql([
        ['create', 'foo', 'auto']
      ]);
    });

    it('should call window.ga() with ga options if they are given', function () {
      ga.initialize('foo', { gaOptions: { userId: 123 } });
      getGaCalls().should.eql([
        ['create', 'foo', { userId: 123 }]
      ]);
    });

    it('should abort, log warning if tracking ID is not given', function () {
      ga.initialize();
      console.warn.args.should.eql([
        ['[react-ga]', 'gaTrackingID is required in initialize()']
      ]);
      getGaCalls().should.eql([]);
    });
  });

  /**
   * set()
   */

  describe('set()', function () {

    it('should output debug info, if debug is on', function () {
      ga.initialize('foo', { debug: true });
      ga.set({ userId: 123 });
      console.info.args.should.eql([
        ['[react-ga]', "called ga('set', fieldsObject);"],
        ['[react-ga]', 'with fieldsObject: {"userId":123}']
      ]);
    });

    it('should warn if fieldsObject object is missing', function () {
      ga.initialize('foo');
      ga.set();
      console.warn.args.should.eql([
        ['[react-ga]', '`fieldsObject` is required in .set()']
      ]);
    });

    it('should warn if fieldsObject is not an Object', function () {
      ga.initialize('foo');
      ga.set(123);
      console.warn.args.should.eql([
        ['[react-ga]', 'Expected `fieldsObject` arg to be an Object']
      ]);
    });

    it('should warn if fieldsObject object is an empty object', function () {
      ga.initialize('foo');
      ga.set({});
      console.warn.args.should.eql([
        ['[react-ga]', 'empty `fieldsObject` given to .set()']
      ]);
    });

    it('should set the field values', function () {
      ga.initialize('foo');
      ga.set({ userId: 123 });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['set', { userId: 123 }]
      ]);
    });
  });

  /**
   * send()
   */

  describe('send()', function () {
    it('should record a pageview using send', function () {
      ga.initialize('foo');
      ga.send({
        hitType: 'pageview',
        page: '/valid'
      });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        [
          'send',
          {
            hitType: 'pageview',
            page: '/valid'
          }
        ]
      ]);
    });

    it('should record an event using send', function () {
      ga.initialize('foo');
      ga.send({
        hitType: 'event',
        eventCategory: 'category',
        eventAction: 'action'
      });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        [
          'send',
          {
            hitType: 'event',
            eventCategory: 'category',
            eventAction: 'action'
          }
        ]
      ]);
    });
  });

  /**
   * pageview()
   */

  describe('pageview()', function () {

    it('should output debug info, if debug is on', function () {
      var options = { debug: true };
      ga.initialize('foo', options);
      ga.pageview('/valid');
      console.info.args.should.eql([
        ['[react-ga]', "called ga('send', 'pageview', path);"],
        ['[react-ga]', 'with path: /valid']
      ]);
    });

    it('should record a pageview', function () {
      ga.initialize('foo');
      ga.pageview('/valid');
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', 'pageview', '/valid']
      ]);
    });

    it('should abort, log warning if path is not provided', function () {
      ga.initialize('foo');
      ga.pageview();
      console.warn.args.should.eql([
        ['[react-ga]', 'path is required in .pageview()']
      ]);
    });

    it('should abort, log warning if path is empty string', function () {
      ga.initialize('foo');
      ga.pageview('');
      console.warn.args.should.eql([
        ['[react-ga]', 'path is required in .pageview()']
      ]);
    });

    it('should abort, log warning if path is empty string of spaces', function () {
      ga.initialize('foo');
      ga.pageview('  ');
      console.warn.args.should.eql([
        ['[react-ga]', 'path cannot be an empty string in .pageview()']
      ]);
    });
  });

  /**
   * modalview()
   */

  describe('modalview()', function () {

    it('should output debug info, if debug is on', function () {
      var options = { debug: true };
      ga.initialize('foo', options);
      ga.modalview('valid');
      console.info.args.should.eql([
        ['[react-ga]', "called ga('send', 'pageview', path);"],
        ['[react-ga]', 'with path: /modal/valid']
      ]);
    });

    it('should record a modalview', function () {
      ga.initialize('foo');
      ga.modalview('valid');
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', 'pageview', '/modal/valid']
      ]);
    });

    it('should remove a leading slash', function () {
      ga.initialize('foo');
      ga.modalview('/valid');
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', 'pageview', '/modal/valid']
      ]);
    });

    it('should abort, log warning if modalName is not provided', function () {
      ga.initialize('foo');
      ga.modalview();
      console.warn.args.should.eql([
        ['[react-ga]', 'modalName is required in .modalview(modalName)']
      ]);
    });

    it('should abort, log warning if modalName is empty string', function () {
      ga.initialize('foo');
      ga.modalview('');
      console.warn.args.should.eql([
        ['[react-ga]', 'modalName is required in .modalview(modalName)']
      ]);
    });

    it('should abort, log warning if modalName is empty string of spaces', function () {
      ga.initialize('foo');
      ga.modalview('  ');
      console.warn.args.should.eql([
        ['[react-ga]', 'modalName cannot be an empty string or a single / in .modalview()']
      ]);
    });

    it('should abort, log warning if modalName is /', function () {
      ga.initialize('foo');
      ga.modalview('/');
      console.warn.args.should.eql([
        ['[react-ga]', 'modalName cannot be an empty string or a single / in .modalview()']
      ]);
    });
  });

  /**
   * exception()
   */

  describe('exception()', function () {

    it('should record an exception', function () {
      ga.initialize('foo');
      ga.exception({});
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', { hitType: 'exception' }]
      ]);
    });

    it('should record a description value', function () {
      ga.initialize('foo');
      ga.exception({ description: 'This is an exception!' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', { exDescription: 'This Is an Exception!', hitType: 'exception' }]
      ]);
    });

    it('should record a fatal value', function () {
      ga.initialize('foo');
      ga.exception({ fatal: true });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', { exFatal: true, hitType: 'exception' }]
      ]);
    });

    it('should reject a non-boolean fatal value', function () {
      ga.initialize('foo');
      ga.exception({ fatal: 'this-is-fatal' });
      console.warn.args.should.eql([[
        '[react-ga]', '`args.fatal` must be a boolean.'
      ]]);
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', { hitType: 'exception' }]
      ]);
    });
  });

  /**
   * timing()
   */

  describe('timing()', function () {
    it('should warn if args object is missing', function () {
      ga.initialize('foo');
      ga.timing();
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if category arg is missing', function () {
      ga.initialize('foo');
      ga.timing({ variable: 'Timing test', value: 1000 });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if category arg is empty string value', function () {
      ga.initialize('foo');
      ga.timing({ category: '', variable: 'Timing test', value: 1000 });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if variable arg is missing', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', value: 1000 });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if variable arg is empty string value', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', value: 1000, variable: '' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if value arg is missing', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', variable: 'Timing test' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should warn if value arg is not a number', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', variable: 'Timing test', value: 'Not a number' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category, args.variable AND args.value are required in timing() ' +
                        'AND args.value has to be a number']
      ]);
    });

    it('should create timing event without timingLabel', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', variable: 'Timing test', value: 1000 });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          timingVar: 'Timing Test',
          timingCategory: 'Test',
          timingValue: 1000,
          hitType: 'timing'
        }]
      ]);
    });

    it('should create timing event with timingLabel', function () {
      ga.initialize('foo');
      ga.timing({ category: 'Test', variable: 'Timing test',
                  value: 1000, label: 'Timing test label' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          timingVar: 'Timing Test',
          timingCategory: 'Test',
          timingValue: 1000,
          timingLabel: 'Timing Test Label',
          hitType: 'timing'
        }]
      ]);
    });
  });

  /**
   * event()
   */

  describe('event()', function () {
    it('should record an event', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          hitType: 'event'
        }]
      ]);
    });

    it('should record an event with strings converted to titleCase', function () {
      ga.initialize('foo');
      ga.event({ category: 'test', action: 'send test' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          hitType: 'event'
        }]
      ]);
    });

    it('should not convert strings to titleCase if the flag is false', function () {
      ga.initialize('foo', { titleCase: false });
      ga.event({ category: 'test', action: 'send test' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'send test',
          eventCategory: 'test',
          hitType: 'event'
        }]
      ]);
    });

    it('should warn if args object is missing', function () {
      ga.initialize('foo');
      ga.event();
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category AND args.action are required in event()']
      ]);
    });

    it('should warn if category is missing', function () {
      ga.initialize('foo');
      ga.event({ action: 'Send Test' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category AND args.action are required in event()']
      ]);
    });

    it('should warn if category is empty string', function () {
      ga.initialize('foo');
      ga.event({ category: '', action: 'Send Test' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category AND args.action are required in event()']
      ]);
    });

    it('should warn if action is missing', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category AND args.action are required in event()']
      ]);
    });

    it('should warn if action is empty string', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: '' });
      console.warn.args.should.eql([
        ['[react-ga]', 'args.category AND args.action are required in event()']
      ]);
    });

    it('should record a label value', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test', label: 'Test Label Value' });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          eventLabel: 'Test Label Value',
          hitType: 'event'
        }]
      ]);
    });

    it('should record a value value', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test', value: 10 });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          eventValue: 10,
          hitType: 'event'
        }]
      ]);
    });

    it('should reject a non-numeric value value', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test', value: 'millions' });
      console.warn.args.should.eql([[
        '[react-ga]', 'Expected `args.value` arg to be a Number.'
      ]]);
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          hitType: 'event'
        }]
      ]);
    });

    it('should record a nonInteraction value', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test', nonInteraction: true });
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          nonInteraction: true,
          hitType: 'event'
        }]
      ]);
    });

    it('should reject a non-boolean nonInteraction value', function () {
      ga.initialize('foo');
      ga.event({ category: 'Test', action: 'Send Test', nonInteraction: 'yeahsure' });
      console.warn.args.should.eql([[
        '[react-ga]', '`args.nonInteraction` must be a boolean.'
      ]]);
      getGaCalls().should.eql([
        ['create', 'foo', 'auto'],
        ['send', {
          eventAction: 'Send Test',
          eventCategory: 'Test',
          hitType: 'event'
        }]
      ]);
    });
  });

  /**
   * outboundLink()
   */

  describe('outboundLink()', function () {
    it('should record an outboundLink event', function (done) {
      ga.initialize('foo');
      ga.outboundLink({ label: 'Test Click' }, function () {
        // we need a reference to the function to compare in the
        // getGaCalls() test below
        var functionCalledBack = getGaCalls()[1][1].hitCallback;
        functionCalledBack.should.be.a.Function; // jshint ignore:line

        getGaCalls().should.eql([
          ['create', 'foo', 'auto'],
          ['send', {
            eventAction: 'Click',
            eventCategory: 'Outbound',
            eventLabel: 'Test Click',
            hitCallback: functionCalledBack,
            hitType: 'event'
          }]
        ]);
        done();
      });
    });

    it('should warn if all args are missing', function () {
      ga.initialize('foo');
      ga.outboundLink();
      console.warn.args.should.eql([[
        '[react-ga]', 'hitCallback function is required'
      ]]);
    });

    it('should warn if label arg is missing', function () {
      ga.initialize('foo');
      ga.outboundLink({ missing: 'labelarg' }, function () {
        // do nothing on callback
      });

      console.warn.args.should.eql([[
        '[react-ga]', 'args.label is required in outboundLink()'
      ]]);
    });

    it('should warn if hitCallback is missing', function () {
      ga.initialize('foo');
      ga.outboundLink({ label: 'Missing hitCallback' });
      console.warn.args.should.eql([[
        '[react-ga]', 'hitCallback function is required'
      ]]);
    });

    it('should fire hitCallback if ga is defined', function (done) {
      ga.initialize('foo');
      ga.outboundLink({ label: 'http://www.google.com' }, function () {
        done();
      });
    });

    it('should fire hitCallback if ga is not defined', function (done) {
      ga.outboundLink({ label: 'http://www.google.com' }, function () {
        done();
      });
    });

    it('should fire hitCallback if ga is available and responds in under 250ms', function (done) {
      // use fake timers to simulate response time from GA
      this.clock = sinon.useFakeTimers();

      ga.initialize('foo');
      var simulateGACallback = function () {
        done();
      };

      ga.outboundLink({ label: 'http://www.google.com' }, simulateGACallback);

      this.clock.tick(125);
      var functionCalledBack = getGaCalls()[1][1].hitCallback;
      functionCalledBack();
      this.clock.restore();
    });

    it('should not fire hitCallback twice if ga responds after 250ms', function (done) {
      // use fake timers to simulate response time from GA
      this.clock = sinon.useFakeTimers();

      ga.initialize('foo');
      var simulateGACallback = function () {
        done();
      };

      ga.outboundLink({ label: 'http://www.google.com' }, simulateGACallback);

      this.clock.tick(260);
      var functionCalledBack = getGaCalls()[1][1].hitCallback;
      functionCalledBack();
      this.clock.restore();
    });

    it('should fire hitCallback if ga is not available after 250ms', function (done) {
      ga.initialize('foo');
      var simulateGACallback = function () {
        done();
      };

      ga.outboundLink({ label: 'http://www.google.com' }, simulateGACallback);

      var simulatedResponseTime = 275;
      setTimeout(function () {
        should.fail('no response ' + simulatedResponseTime + ' ms', 'response after 250 ms',
                    'message', 'operator');
      }, simulatedResponseTime);
    });
  });

  /**
   * OutboundLink()
   */

  describe('OutboundLink()', function () {
    it('should create a React component <OutboundLink>', function () {
      ga.initialize();

      var OutboundLinkComponent = ga.OutboundLink;
      TestUtils.isElement(OutboundLinkComponent);
      OutboundLinkComponent.displayName.should.equal('OutboundLink');
    });

  });

  /**
   * plugin()
   */

  describe('Plugin', function () {

    it('should require the plugin: ecommerce', function () {
      ga.initialize('plugin');
      ga.plugin.require('ecommerce');

      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['require', 'ecommerce']
      ]);
    });

    it('should execute ecommerce:addItem', function () {
      ga.initialize('plugin');
      ga.plugin.execute('ecommerce', 'addItem', { id: 1, name: 'Product' });

      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['ecommerce:addItem', { id: 1, name: 'Product' }]
      ]);
    });

    it('should execute ec:setAction \'checkout\' with payload { \'step\': 1 }', function () {
      ga.initialize('plugin');
      ga.plugin.execute('ec', 'setAction', 'checkout', { step: 1 });
      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['ec:setAction', 'checkout', { step: 1 }]
      ]);
    });

    it('should execute ecommerce:addItem', function () {
      ga.initialize('plugin');
      ga.plugin.execute('ecommerce', 'addItem', {
        id: 1,
        name: 'Product'
      });

      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['ecommerce:addItem', { id: 1, name: 'Product' }]
      ]);
    });

    it('should execute ecommerce:send', function () {
      ga.initialize('plugin');
      ga.plugin.execute('ecommerce', 'send');
      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['ecommerce:send']
      ]);
    });

    it('should execute ec:setAction \'checkout\' with payload { \'step\': 1 }', function () {
      ga.initialize('plugin');
      ga.plugin.execute('ec', 'setAction', 'checkout', { step: 1 });
      getGaCalls().should.eql([
        ['create', 'plugin', 'auto'],
        ['ec:setAction', 'checkout', { step: 1 }]
      ]);
    });
  });
});


text:
using System.Data.Entity;
using AirportSystem.Contracts.Data;

namespace AirportSystem.Data
{
    public class AirportSystemSqliteData : IAirportSystemSqliteData
    {
        private readonly DbContext context;

        public AirportSystemSqliteData(DbContext context)
        {
            this.context = context;
        }
    }
}