text:
<?php

namespace DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRElementDefinition;

use DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement;
use DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRConstraintSeverity;
use DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRId;
use DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString;
use DCarbone\PHPFHIRGenerated\DSTU2\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\DSTU2\PHPFHIRTypeInterface;

/**
 * Captures constraints on each element within the resource, profile, or extension.
 * 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 FHIRElementDefinitionConstraint
 * @package \DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRElementDefinition
 */
class FHIRElementDefinitionConstraint extends FHIRElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT;
    const FIELD_HUMAN = 'human';
    const FIELD_HUMAN_EXT = '_human';
    const FIELD_KEY = 'key';
    const FIELD_KEY_EXT = '_key';
    const FIELD_REQUIREMENTS = 'requirements';
    const FIELD_REQUIREMENTS_EXT = '_requirements';
    const FIELD_SEVERITY = 'severity';
    const FIELD_SEVERITY_EXT = '_severity';
    const FIELD_XPATH = 'xpath';
    const FIELD_XPATH_EXT = '_xpath';

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

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Text that can be used to describe the constraint in messages identifying that
     * the constraint has been violated.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    protected $human = null;

    /**
     * Any combination of letters, numerals, "-" and ".", with a length limit of 64
     * characters. (This might be an integer, an unprefixed OID, UUID or any other
     * identifier pattern that meets these constraints.) Ids are case-insensitive.
     * RFC 4122
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Allows identification of which elements have their cardinalities impacted by the
     * constraint. Will not be referenced for constraints that do not affect
     * cardinality.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRId
     */
    protected $key = null;

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Description of why this constraint is necessary or appropriate.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    protected $requirements = null;

    /**
     * SHALL applications comply with this constraint?
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Identifies the impact constraint violation has on the conformance of the
     * instance.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRConstraintSeverity
     */
    protected $severity = null;

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An XPath expression of constraint that can be executed to see if this constraint
     * is met.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    protected $xpath = null;

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

    /**
     * FHIRElementDefinitionConstraint Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIRElementDefinitionConstraint::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_HUMAN]) || isset($data[self::FIELD_HUMAN_EXT])) {
            if (isset($data[self::FIELD_HUMAN])) {
                $value = $data[self::FIELD_HUMAN];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_HUMAN_EXT]) && is_array($data[self::FIELD_HUMAN_EXT])) {
                $ext = $data[self::FIELD_HUMAN_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setHuman($value);
                } else if (is_array($value)) {
                    $this->setHuman(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setHuman(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setHuman(new FHIRString($ext));
            }
        }
        if (isset($data[self::FIELD_KEY]) || isset($data[self::FIELD_KEY_EXT])) {
            if (isset($data[self::FIELD_KEY])) {
                $value = $data[self::FIELD_KEY];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_KEY_EXT]) && is_array($data[self::FIELD_KEY_EXT])) {
                $ext = $data[self::FIELD_KEY_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRId) {
                    $this->setKey($value);
                } else if (is_array($value)) {
                    $this->setKey(new FHIRId(array_merge($ext, $value)));
                } else {
                    $this->setKey(new FHIRId([FHIRId::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setKey(new FHIRId($ext));
            }
        }
        if (isset($data[self::FIELD_REQUIREMENTS]) || isset($data[self::FIELD_REQUIREMENTS_EXT])) {
            if (isset($data[self::FIELD_REQUIREMENTS])) {
                $value = $data[self::FIELD_REQUIREMENTS];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_REQUIREMENTS_EXT]) && is_array($data[self::FIELD_REQUIREMENTS_EXT])) {
                $ext = $data[self::FIELD_REQUIREMENTS_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setRequirements($value);
                } else if (is_array($value)) {
                    $this->setRequirements(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setRequirements(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setRequirements(new FHIRString($ext));
            }
        }
        if (isset($data[self::FIELD_SEVERITY]) || isset($data[self::FIELD_SEVERITY_EXT])) {
            if (isset($data[self::FIELD_SEVERITY])) {
                $value = $data[self::FIELD_SEVERITY];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_SEVERITY_EXT]) && is_array($data[self::FIELD_SEVERITY_EXT])) {
                $ext = $data[self::FIELD_SEVERITY_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRConstraintSeverity) {
                    $this->setSeverity($value);
                } else if (is_array($value)) {
                    $this->setSeverity(new FHIRConstraintSeverity(array_merge($ext, $value)));
                } else {
                    $this->setSeverity(new FHIRConstraintSeverity([FHIRConstraintSeverity::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setSeverity(new FHIRConstraintSeverity($ext));
            }
        }
        if (isset($data[self::FIELD_XPATH]) || isset($data[self::FIELD_XPATH_EXT])) {
            if (isset($data[self::FIELD_XPATH])) {
                $value = $data[self::FIELD_XPATH];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_XPATH_EXT]) && is_array($data[self::FIELD_XPATH_EXT])) {
                $ext = $data[self::FIELD_XPATH_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRString) {
                    $this->setXpath($value);
                } else if (is_array($value)) {
                    $this->setXpath(new FHIRString(array_merge($ext, $value)));
                } else {
                    $this->setXpath(new FHIRString([FHIRString::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setXpath(new FHIRString($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 "<ElementDefinitionConstraint{$xmlns}></ElementDefinitionConstraint>";
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Text that can be used to describe the constraint in messages identifying that
     * the constraint has been violated.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    public function getHuman()
    {
        return $this->human;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Text that can be used to describe the constraint in messages identifying that
     * the constraint has been violated.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString $human
     * @return static
     */
    public function setHuman($human = null)
    {
        if (null === $human) {
            $this->human = null;
            return $this;
        }
        if ($human instanceof FHIRString) {
            $this->human = $human;
            return $this;
        }
        $this->human = new FHIRString($human);
        return $this;
    }

    /**
     * Any combination of letters, numerals, "-" and ".", with a length limit of 64
     * characters. (This might be an integer, an unprefixed OID, UUID or any other
     * identifier pattern that meets these constraints.) Ids are case-insensitive.
     * RFC 4122
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Allows identification of which elements have their cardinalities impacted by the
     * constraint. Will not be referenced for constraints that do not affect
     * cardinality.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRId
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * Any combination of letters, numerals, "-" and ".", with a length limit of 64
     * characters. (This might be an integer, an unprefixed OID, UUID or any other
     * identifier pattern that meets these constraints.) Ids are case-insensitive.
     * RFC 4122
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * Allows identification of which elements have their cardinalities impacted by the
     * constraint. Will not be referenced for constraints that do not affect
     * cardinality.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRId $key
     * @return static
     */
    public function setKey($key = null)
    {
        if (null === $key) {
            $this->key = null;
            return $this;
        }
        if ($key instanceof FHIRId) {
            $this->key = $key;
            return $this;
        }
        $this->key = new FHIRId($key);
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Description of why this constraint is necessary or appropriate.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    public function getRequirements()
    {
        return $this->requirements;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Description of why this constraint is necessary or appropriate.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString $requirements
     * @return static
     */
    public function setRequirements($requirements = null)
    {
        if (null === $requirements) {
            $this->requirements = null;
            return $this;
        }
        if ($requirements instanceof FHIRString) {
            $this->requirements = $requirements;
            return $this;
        }
        $this->requirements = new FHIRString($requirements);
        return $this;
    }

    /**
     * SHALL applications comply with this constraint?
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Identifies the impact constraint violation has on the conformance of the
     * instance.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRConstraintSeverity
     */
    public function getSeverity()
    {
        return $this->severity;
    }

    /**
     * SHALL applications comply with this constraint?
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * Identifies the impact constraint violation has on the conformance of the
     * instance.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRConstraintSeverity $severity
     * @return static
     */
    public function setSeverity(FHIRConstraintSeverity $severity = null)
    {
        $this->severity = $severity;
        return $this;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An XPath expression of constraint that can be executed to see if this constraint
     * is met.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString
     */
    public function getXpath()
    {
        return $this->xpath;
    }

    /**
     * A sequence of Unicode characters
     * Note that FHIR strings may not exceed 1MB in size
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * An XPath expression of constraint that can be executed to see if this constraint
     * is met.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRString $xpath
     * @return static
     */
    public function setXpath($xpath = null)
    {
        if (null === $xpath) {
            $this->xpath = null;
            return $this;
        }
        if ($xpath instanceof FHIRString) {
            $this->xpath = $xpath;
            return $this;
        }
        $this->xpath = new FHIRString($xpath);
        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->getHuman())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_HUMAN] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getKey())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_KEY] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getRequirements())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_REQUIREMENTS] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getSeverity())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_SEVERITY] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getXpath())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_XPATH] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_HUMAN])) {
            $v = $this->getHuman();
            foreach($validationRules[self::FIELD_HUMAN] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT, self::FIELD_HUMAN, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_HUMAN])) {
                        $errs[self::FIELD_HUMAN] = [];
                    }
                    $errs[self::FIELD_HUMAN][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_KEY])) {
            $v = $this->getKey();
            foreach($validationRules[self::FIELD_KEY] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT, self::FIELD_KEY, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_KEY])) {
                        $errs[self::FIELD_KEY] = [];
                    }
                    $errs[self::FIELD_KEY][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_REQUIREMENTS])) {
            $v = $this->getRequirements();
            foreach($validationRules[self::FIELD_REQUIREMENTS] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT, self::FIELD_REQUIREMENTS, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_REQUIREMENTS])) {
                        $errs[self::FIELD_REQUIREMENTS] = [];
                    }
                    $errs[self::FIELD_REQUIREMENTS][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_SEVERITY])) {
            $v = $this->getSeverity();
            foreach($validationRules[self::FIELD_SEVERITY] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT, self::FIELD_SEVERITY, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_SEVERITY])) {
                        $errs[self::FIELD_SEVERITY] = [];
                    }
                    $errs[self::FIELD_SEVERITY][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_XPATH])) {
            $v = $this->getXpath();
            foreach($validationRules[self::FIELD_XPATH] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_ELEMENT_DEFINITION_DOT_CONSTRAINT, self::FIELD_XPATH, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_XPATH])) {
                        $errs[self::FIELD_XPATH] = [];
                    }
                    $errs[self::FIELD_XPATH][$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\DSTU2\FHIRElement\FHIRElementDefinition\FHIRElementDefinitionConstraint $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRElementDefinition\FHIRElementDefinitionConstraint
     */
    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('FHIRElementDefinitionConstraint::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('FHIRElementDefinitionConstraint::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIRElementDefinitionConstraint;
        } elseif (!is_object($type) || !($type instanceof FHIRElementDefinitionConstraint)) {
            throw new \RuntimeException(sprintf(
                'FHIRElementDefinitionConstraint::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\DSTU2\FHIRElement\FHIRElementDefinition\FHIRElementDefinitionConstraint 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->human)) {
            $type->setHuman(FHIRString::xmlUnserialize($children->human));
        }
        if (isset($attributes->human)) {
            $pt = $type->getHuman();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->human);
            } else {
                $type->setHuman((string)$attributes->human);
            }
        }
        if (isset($children->key)) {
            $type->setKey(FHIRId::xmlUnserialize($children->key));
        }
        if (isset($attributes->key)) {
            $pt = $type->getKey();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->key);
            } else {
                $type->setKey((string)$attributes->key);
            }
        }
        if (isset($children->requirements)) {
            $type->setRequirements(FHIRString::xmlUnserialize($children->requirements));
        }
        if (isset($attributes->requirements)) {
            $pt = $type->getRequirements();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->requirements);
            } else {
                $type->setRequirements((string)$attributes->requirements);
            }
        }
        if (isset($children->severity)) {
            $type->setSeverity(FHIRConstraintSeverity::xmlUnserialize($children->severity));
        }
        if (isset($children->xpath)) {
            $type->setXpath(FHIRString::xmlUnserialize($children->xpath));
        }
        if (isset($attributes->xpath)) {
            $pt = $type->getXpath();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->xpath);
            } else {
                $type->setXpath((string)$attributes->xpath);
            }
        }
        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->getHuman())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_HUMAN, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getKey())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_KEY, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getRequirements())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_REQUIREMENTS, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getSeverity())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_SEVERITY, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getXpath())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_XPATH, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getHuman())) {
            $a[self::FIELD_HUMAN] = $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_HUMAN_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getKey())) {
            $a[self::FIELD_KEY] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRId::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRId::FIELD_VALUE]);
                $a[self::FIELD_KEY_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getRequirements())) {
            $a[self::FIELD_REQUIREMENTS] = $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_REQUIREMENTS_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getSeverity())) {
            $a[self::FIELD_SEVERITY] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRConstraintSeverity::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRConstraintSeverity::FIELD_VALUE]);
                $a[self::FIELD_SEVERITY_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getXpath())) {
            $a[self::FIELD_XPATH] = $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_XPATH_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:
package org.intelligentsia.dowsers.command;

import org.intelligentsia.dowsers.core.Handler;

import com.google.common.base.Preconditions;

/**
 * FakeHelloCommandHandler which implement an handler for FakeHelloCommand and
 * register himself on a CommandHandlerRegistry instance..
 *
 * @author Jerome Guibert
 *
 */
public class FakeHelloCommandHandler implements Handler<FakeHelloCommand> {

	/**
	 * for test purpose.
	 */
	private String lastCalled = null;

	/**
	 * Build a new instance of FakeHelloCommandHandler.
	 *
	 * @param commandRegistry
	 *            command Registry where to register
	 * @throws NullPointerException
	 *             if commandRegistry is null
	 */
	public FakeHelloCommandHandler(final CommandHandlerRegistry commandRegistry) throws NullPointerException {
		super();
		Preconditions.checkNotNull(commandRegistry).register(this);
	}

	/**
	 * @see org.intelligentsia.dowsers.core.Handler#handle(java.lang.Object)
	 */
	@Override
	public void handle(final FakeHelloCommand command) {
		lastCalled = command.getName();
	}

	/**
	 * @return the lastCalled
	 */
	public String getLastCalled() {
		return lastCalled;
	}

}

redpajama_set_name: RedPajamaGithub


text:
Imports System.Math
Imports System.Runtime.InteropServices
Imports System.Text.RegularExpressions

Imports Rstyx.Utilities.IO
Imports Rstyx.Utilities.Math.MathExtensions

Namespace Domain

    '''  Representation of a geodetic point with track geometry values.
     ''' <remarks></remarks>
    Public Class GeoTcPoint
        Inherits GeoPoint

        Implements IDTMatPoint
        Implements IPointAtTrackGeometry

        #Region "Private Fields"

            'Private Shared Logger As Rstyx.LoggingConsole.Logger = Rstyx.LoggingConsole.LogBox.getLogger("Rstyx.Utilities.Domain.GeoTcPoint")

        #End Region

        #Region "Constuctor"

            '''  Creates a new <see cref="GeoTcPoint"/>.
            Public Sub New()
                PropertyAttributes.Add("Km", Rstyx.Utilities.Resources.Messages.Domain_AttName_TrackKm)   ' "StrKm"
            End Sub

            '''  Creates a new <see cref="GeoTcPoint"/> and inititializes it's properties from any given <see cref="IGeoPoint"/>.
             ''' <param name="SourcePoint"> The source point to get init values from. May be <see langword="null"/>. </param>
             ''' <remarks> For details see <see cref="GetPropsFromIGeoPoint"/>. </remarks>
             ''' <exception cref="ParseException"> ID of <paramref name="SourcePoint"/> isn't a valid ID for this point (The <see cref="ParseError"/> only contains a message.). </exception>
            Public Sub New(SourcePoint As IGeoPoint)

                Me.New()
                Me.GetPropsFromIGeoPoint(SourcePoint)
            End Sub

        #End Region

        #Region "IDTMatPoint Members"

            ''' <inheritdoc/>
            Public Property ZDGM()          As Double = Double.NaN   Implements IDTMatPoint.ZDGM

            ''' <inheritdoc/>
            Public Property HDGM()          As Double = Double.NaN   Implements IDTMatPoint.HDGM

            ''' <inheritdoc/>
            Public Property NameOfDTM()     As String = String.Empty Implements IDTMatPoint.NameOfDTM

        #End Region

        #Region "IPointAtTrackGeometry Members"

            ''' <inheritdoc/>
            Public Property St()            As Kilometer = New Kilometer() Implements IPointAtTrackGeometry.St

            ''' <inheritdoc/>
            Public Property Km()            As Kilometer = New Kilometer() Implements IPointAtTrackGeometry.Km

            ''' <inheritdoc/>
            Public Property Q()             As Double = Double.NaN Implements IPointAtTrackGeometry.Q

            ''' <inheritdoc/>
            Public Property QKm()           As Double = Double.NaN Implements IPointAtTrackGeometry.QKm

            ''' <inheritdoc/>
            Public Property HSOK()          As Double = Double.NaN Implements IPointAtTrackGeometry.HSOK

            ''' <inheritdoc/>
            Public Property H()             As Double = Double.NaN Implements IPointAtTrackGeometry.H

            ''' <inheritdoc/>
            Public Property G()             As Double = Double.NaN Implements IPointAtTrackGeometry.G

            ''' <inheritdoc/>
            Public Property ZSOK()          As Double = Double.NaN Implements IPointAtTrackGeometry.ZSOK

            ''' <inheritdoc/>
            Public Property ZLGS()          As Double = Double.NaN Implements IPointAtTrackGeometry.ZLGS

            ''' <inheritdoc/>
            Public Property RaLGS()         As Double = Double.NaN Implements IPointAtTrackGeometry.RaLGS

            ''' <inheritdoc/>
            Public Property AbLGS()         As Double = Double.NaN Implements IPointAtTrackGeometry.AbLGS

            ''' <inheritdoc/>
            Public Property QG()            As Double = Double.NaN Implements IPointAtTrackGeometry.QG

            ''' <inheritdoc/>
            Public Property HG()            As Double = Double.NaN Implements IPointAtTrackGeometry.HG

            ''' <inheritdoc/>
            Public Property LG()            As Double = Double.NaN Implements IPointAtTrackGeometry.LG

            ''' <inheritdoc/>
            Public Property RG()            As Double = Double.NaN Implements IPointAtTrackGeometry.RG

            ''' <inheritdoc/>
            Public Property V()             As Double = Double.NaN Implements IPointAtTrackGeometry.V

            ''' <inheritdoc/>
            Public Property QGS()           As Double = Double.NaN Implements IPointAtTrackGeometry.QGS

            ''' <inheritdoc/>
            Public Property HGS()           As Double = Double.NaN Implements IPointAtTrackGeometry.HGS

            ''' <inheritdoc/>
            Public Property R()             As Double = Double.NaN Implements IPointAtTrackGeometry.R

            ''' <inheritdoc/>
            Public Property L()             As Double = Double.NaN Implements IPointAtTrackGeometry.L

            ''' <inheritdoc/>
            Public Property Tm()            As Double = Double.NaN Implements IPointAtTrackGeometry.Tm

            ''' <inheritdoc/>
            Public Property QT()            As Double = Double.NaN Implements IPointAtTrackGeometry.QT

            ''' <inheritdoc/>
            Public Property QGT()           As Double = Double.NaN Implements IPointAtTrackGeometry.QGT

            ''' <inheritdoc/>
            Public Property HGT()           As Double = Double.NaN Implements IPointAtTrackGeometry.HGT

            ''' <inheritdoc/>
            Public Property Ra()            As Double = Double.NaN Implements IPointAtTrackGeometry.Ra

            ''' <inheritdoc/>
            Public Property Ri()            As Double = Double.NaN Implements IPointAtTrackGeometry.Ri

            ''' <inheritdoc/>
            Public Property Ueb()           As Double = Double.NaN Implements IPointAtTrackGeometry.Ueb

            ''' <inheritdoc/>
            Public Property Heb()           As Double = Double.NaN Implements IPointAtTrackGeometry.Heb

            ''' <inheritdoc/>
            ''' <remarks> This value defaults to 1.500. </remarks>
            Public Property CantBase()      As Double = 1.500 Implements IPointAtTrackGeometry.CantBase

            ''' <inheritdoc/>
            Public Property Speed()         As Double = Double.NaN Implements IPointAtTrackGeometry.Speed

            ''' <inheritdoc/>
            Public Property YA()            As Double = Double.NaN Implements IPointAtTrackGeometry.YA

            ''' <inheritdoc/>
            Public Property XA()            As Double = Double.NaN Implements IPointAtTrackGeometry.XA

            ''' <inheritdoc/>
            Public Property ZA()            As Double = Double.NaN Implements IPointAtTrackGeometry.ZA

            ''' <inheritdoc/>
            Public Property MiniR()         As Double = Double.NaN Implements IPointAtTrackGeometry.MiniR

            ''' <inheritdoc/>
            Public Property MiniUeb()       As Double = Double.NaN Implements IPointAtTrackGeometry.MiniUeb

            ''' <inheritdoc/>
            Public Property TrackRef()      As TrackGeometryInfo = Nothing Implements IPointAtTrackGeometry.TrackRef

        #End Region

        #Region "Public Methods"

            '''  Transforms <see cref="GeoTcPoint.Q"/> and <see cref="GeoTcPoint.HSOK"/> to <see cref="GeoTcPoint.QG"/> and <see cref="GeoTcPoint.HG"/> if possible.
             ''' <para>
             ''' Sign of cant: Positive is treated as "normal", negative as "inverse".
             ''' </para>
             ''' <para>
             ''' If this transformation isn't possible, the target values will be set to <c>Double.NaN</c>.
             ''' </para>
            Public Sub TransformHorizontalToCanted()

                If (Me.Ueb.EqualsTolerance(0, 0.0005)) Then

                    Me.QG = Me.Q
                    Me.HG = Me.HSOK

                ElseIf (Not (Double.IsNaN(Me.Ueb) OrElse Double.IsNaN(Me.CantBase) OrElse Double.IsNaN(Me.Ra) OrElse Me.Ra.EqualsTolerance(0, 0.001))) Then

                    'Dim sf      As Integer = Sign(Me.Ra) * Sign(Me.Ueb)
                    'Dim cbh     As Double  = Sqrt(Pow(Me.CantBase, 2) - Pow(Me.Ueb, 2))
                    'Dim phi     As Double  = sf * Atan(Abs(Me.Ueb) / cbh) * (-1)
                    'Dim X0      As Double  = Abs(Me.Ueb) / 2
                    'Dim Y0      As Double  = sf * (Me.CantBase - cbh) / 2
                    '
                    'Me.QG = (Me.Q - Y0) * Cos(phi) + (Me.HSOK - X0) * Sin(phi)
                    'Me.HG = (Me.HSOK - X0) * Cos(phi) - (Me.Q - Y0) * Sin(phi)

                    ' 19.08.2019 (Angleichung an iGeo und VermEsn:  Nullpunkt wird nur in der Höhe verschoben um u/2)
                    Dim sf      As Integer = Sign(Me.Ra) * Sign(Me.Ueb)
                    Dim phi     As Double  = sf * Asin(Abs(Me.Ueb) / Me.CantBase) * (-1)
                    Dim CosPhi  As Double  = Cos(phi)
                    Dim SinPhi  As Double  = Sin(phi)
                    Dim X0      As Double  = Abs(Me.Ueb) / 2
                    Dim Y0      As Double  = 0.0

                    Me.QG = ((Me.Q - Y0) * CosPhi) + ((Me.HSOK - X0) * SinPhi)
                    Me.HG = ((Me.HSOK - X0) * CosPhi) - ((Me.Q - Y0) * SinPhi)
            Else
                    Me.QG = Double.NaN
                    Me.HG = Double.NaN
                End If
            End Sub

            '''  Transforms <see cref="GeoTcPoint.QG"/> and <see cref="GeoTcPoint.HG"/> to <see cref="GeoTcPoint.Q"/> and <see cref="GeoTcPoint.HSOK"/> if possible.
             ''' <remarks>
             ''' <para>
             ''' Sign of cant: Positive is treated as "normal", negative as "inverse".
             ''' </para>
             ''' <para>
             ''' If this transformation isn't possible, the target values will be set to <c>Double.NaN</c>.
             ''' </para>
             ''' </remarks>
            Public Sub TransformCantedToHorizontal()

                If (Me.Ueb.EqualsTolerance(0, 0.0005)) Then

                    Me.Q    = Me.QG
                    Me.HSOK = Me.HG

                ElseIf (Not (Double.IsNaN(Me.Ueb) OrElse Double.IsNaN(Me.CantBase) OrElse Double.IsNaN(Me.Ra) OrElse Me.Ra.EqualsTolerance(0, 0.001))) Then

                    'Dim sf      As Integer = Sign(Me.Ra) * Sign(Me.Ueb)
                    'Dim cbh     As Double  = Sqrt(Pow(Me.CantBase, 2) - Pow(Me.Ueb, 2))
                    'Dim phi     As Double  = sf * Atan(Abs(Me.Ueb) / cbh) * (-1)
                    'Dim CosPhi  As Double  = Cos(phi)
                    'Dim SinPhi  As Double  = Sin(phi)
                    'Dim X0      As Double  = Abs(Me.Ueb) / 2
                    'Dim Y0      As Double  = sf * (Me.CantBase - cbh) / 2
                    '
                    'Me.HSOK = X0 + (Me.QG / CosPhi + Me.HG / SinPhi) / (CosPhi / SinPhi + SinPhi / CosPhi)
                    'Me.Q    = Y0 + (Me.QG - (Me.HSOK - X0) * SinPhi) / CosPhi

                    ' 19.08.2019 (Angleichung an iGeo und VermEsn:  Nullpunkt wird nur in der Höhe verschoben um u/2)
                    Dim sf      As Integer = Sign(Me.Ra) * Sign(Me.Ueb)
                    Dim phi     As Double  = sf * Asin(Abs(Me.Ueb) / Me.CantBase) * (-1)
                    Dim CosPhi  As Double  = Cos(phi)
                    Dim SinPhi  As Double  = Sin(phi)
                    Dim X0      As Double  = Abs(Me.Ueb) / 2
                    Dim Y0      As Double  = 0.0

                    Me.HSOK = X0 + (((Me.QG / CosPhi) + (Me.HG / SinPhi)) / ((CosPhi / SinPhi) + (SinPhi / CosPhi)))
                    Me.Q    = Y0 + ((Me.QG - ((Me.HSOK - X0) * SinPhi)) / CosPhi)
            Else
                    Me.Q    = Double.NaN
                    Me.HSOK = Double.NaN
                End If
            End Sub

        #End Region

        #Region "Overrides"

            '''  Sets this point's <see cref="IGeoPoint"/> properties from a given <see cref="IGeoPoint"/>.
             ''' <param name="SourcePoint"> The source point to get init values from. May be <see langword="null"/>. </param>
             ''' <remarks>
             ''' <para>
             ''' If <paramref name="SourcePoint"/> is a <see cref="GeoTcPoint"/>, then all properties will be taken.
             ''' Otherwise, all <see cref="IGeoPoint"/> interface properties (including <see cref="Attributes"/>) will be assigned
             ''' to properties of this point, and selected other properties will be converted to attributes.
             ''' </para>
             ''' <para>
             ''' All attributes from <paramref name="SourcePoint"/>, matching properties that don't belong to <see cref="IGeoPoint"/> interface,
             ''' and are declared in <see cref="PropertyAttributes"/>, will be converted to properties, if the properties have no value yet:
             ''' <list type="table">
             ''' <listheader> <term> Attribute Name </term>  <description> Property Name </description></listheader>
             ''' <item> <term> StrKm   </term>  <description> Km </description></item>
             ''' </list>
             ''' </para>
             ''' </remarks>
             ''' <exception cref="InvalidIDException"> ID of <paramref name="SourcePoint"/> isn't a valid ID for this point. </exception>
            Protected Overrides Sub GetPropsFromIGeoPoint(SourcePoint As IGeoPoint)

                If (SourcePoint IsNot Nothing) Then

                    MyBase.GetPropsFromIGeoPoint(SourcePoint)

                    If (TypeOf SourcePoint Is GeoTcPoint) Then

                        Dim SourceTcPoint As GeoTcPoint = DirectCast(SourcePoint, GeoTcPoint)

                        Me.CantBase   = SourceTcPoint.CantBase
                        Me.AbLGS      = SourceTcPoint.AbLGS
                        Me.G          = SourceTcPoint.G
                        Me.H          = SourceTcPoint.H
                        Me.HDGM       = SourceTcPoint.HDGM
                        Me.HG         = SourceTcPoint.HG
                        Me.HGS        = SourceTcPoint.HGS
                        Me.HGT        = SourceTcPoint.HGT
                        Me.HSOK       = SourceTcPoint.HSOK
                        Me.Heb        = SourceTcPoint.Heb
                        Me.Km         = SourceTcPoint.Km.Clone()
                        Me.L          = SourceTcPoint.L
                        Me.LG         = SourceTcPoint.LG
                        Me.NameOfDTM  = SourceTcPoint.NameOfDTM
                        Me.Q          = SourceTcPoint.Q
                        Me.QG         = SourceTcPoint.QG
                        Me.QGS        = SourceTcPoint.QGS
                        Me.QGT        = SourceTcPoint.QGT
                        Me.QKm        = SourceTcPoint.QKm
                        Me.QT         = SourceTcPoint.QT
                        Me.R          = SourceTcPoint.R
                        Me.RG         = SourceTcPoint.RG
                        Me.Ra         = SourceTcPoint.Ra
                        Me.RaLGS      = SourceTcPoint.RaLGS
                        Me.Ri         = SourceTcPoint.Ri
                        Me.St         = SourceTcPoint.St.Clone()
                        Me.TM         = SourceTcPoint.TM
                        Me.TrackRef   = SourceTcPoint.TrackRef.Clone()
                        Me.Ueb        = SourceTcPoint.Ueb
                        Me.V          = SourceTcPoint.V
                        Me.ZDGM       = SourceTcPoint.ZDGM
                        Me.ZLGS       = SourceTcPoint.ZLGS
                        Me.ZSOK       = SourceTcPoint.ZSOK

                        Me.RemovePropertyAttributes()

                    Else
                        Me.ConvertPropertyAttributes()
                    End If
                End If
            End Sub

            '''  Returns a formatted output of most fields of this GeoTcPoint.
             ''' <returns> Formatted output. </returns>
            Public Overrides Function ToString() As String
                Return StringUtils.sprintf("%+20s %11.3f (%2d) %10.3f %8.3f %8.3f   %8.3f %8.3f %8.3f %11.3f  %4.0f   %4.0f   %4.0f %8.3f %7.0f %9.3f  %-16s %-10s %12.3f %12.3f%9.3f",
                                           Me.ID, Me.Km.Value, Me.Km.Status, Me.St.Value, Me.Q, Me.HSOK, Me.QG, Me.HG, Me.RG, Me.Ra, Me.Ueb * 1000,
                                           Me.ActualCant * 1000, Me.ActualCantAbs * 1000, Me.ZSOK, Me.RaLGS, Me.ZDGM, Me.Info, Me.Kind.ToDisplayString(), Me.Y, Me.X, Me.Z)
            End Function

        #End Region

    End Class

End Namespace

' for jEdit:  :collapseFolds=2::tabSize=4::indentSize=4:


text:
interface Navigator {
    /** This plugin displays and hides a splash screen during application launch. */
    splashscreen: {
        /** Dismiss the splash screen. */
        hide(): void;
        /** Displays the splash screen. */
        show(): void;
    }
}


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,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta content="IE=edge" http-equiv="X-UA-Compatible">

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

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

<link href="../../../../assets/css/default.css?v=7" rel="stylesheet" type="text/css">

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

           Developers

BlockingQueue - Android SDK

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

          Developer
          Console

Results

Loading...

           Developers

        Home

            Android

            Wear

            TV

            Auto

        Design

        Develop

            Training

            API Guides

            Reference

            Tools

            Google Services

            Preview

        Distribute

            Google Play

            Essentials

            Get Users

            Engage & Retain

            Earn

            Analyze

            Stories

          API level:

            <select id="apiLevelSelector">

            </select>

Android APIs

  android

  android.accessibilityservice

  android.accounts

  android.animation

  android.annotation

  android.app

  android.app.admin

  android.app.assist

  android.app.backup

  android.app.job

  android.app.usage

  android.appwidget

  android.bluetooth

  android.bluetooth.le

  android.content

  android.content.pm

  android.content.res

  android.database

  android.database.sqlite

  android.databinding

  android.drm

  android.gesture

  android.graphics

  android.graphics.drawable

  android.graphics.drawable.shapes

  android.graphics.pdf

  android.hardware

  android.hardware.camera2

  android.hardware.camera2.params

  android.hardware.display

  android.hardware.fingerprint

  android.hardware.input

  android.hardware.usb

  android.inputmethodservice

  android.location

  android.media

  android.media.audiofx

  android.media.browse

  android.media.effect

  android.media.midi

  android.media.projection

  android.media.session

  android.media.tv

  android.mtp

  android.net

  android.net.http

  android.net.nsd

  android.net.rtp

  android.net.sip

  android.net.wifi

  android.net.wifi.p2p

  android.net.wifi.p2p.nsd

  android.nfc

  android.nfc.cardemulation

  android.nfc.tech

  android.opengl

  android.os

  android.os.storage

  android.preference

  android.print

  android.print.pdf

  android.printservice

  android.provider

  android.renderscript

  android.sax

  android.security

  android.security.keystore

  android.service.carrier

  android.service.chooser

  android.service.dreams

  android.service.media

  android.service.notification

  android.service.restrictions

  android.service.textservice

  android.service.voice

  android.service.wallpaper

  android.speech

  android.speech.tts

  android.support.annotation

  android.support.app.recommendation

  android.support.customtabs

  android.support.design

  android.support.design.widget

  android.support.multidex

  android.support.percent

  android.support.v13.app

  android.support.v14.preference

  android.support.v17.leanback

  android.support.v17.leanback.app

  android.support.v17.leanback.database

  android.support.v17.leanback.graphics

  android.support.v17.leanback.system

  android.support.v17.leanback.widget

  android.support.v17.preference

  android.support.v4.accessibilityservice

  android.support.v4.animation

  android.support.v4.app

  android.support.v4.content

  android.support.v4.content.pm

  android.support.v4.content.res

  android.support.v4.database

  android.support.v4.graphics

  android.support.v4.graphics.drawable

  android.support.v4.hardware.display

  android.support.v4.hardware.fingerprint

  android.support.v4.media

  android.support.v4.media.session

  android.support.v4.net

  android.support.v4.os

  android.support.v4.print

  android.support.v4.provider

  android.support.v4.text

  android.support.v4.util

  android.support.v4.view

  android.support.v4.view.accessibility

  android.support.v4.view.animation

  android.support.v4.widget

  android.support.v7.app

  android.support.v7.appcompat

  android.support.v7.cardview

  android.support.v7.graphics

  android.support.v7.graphics.drawable

  android.support.v7.gridlayout

  android.support.v7.media

  android.support.v7.mediarouter

  android.support.v7.preference

  android.support.v7.recyclerview

  android.support.v7.util

  android.support.v7.view

  android.support.v7.widget

  android.support.v7.widget.helper

  android.support.v7.widget.util

  android.support.v8.renderscript

  android.system

  android.telecom

  android.telephony

  android.telephony.cdma

  android.telephony.gsm

  android.test

  android.test.mock

  android.test.suitebuilder

  android.test.suitebuilder.annotation

  android.text

  android.text.format

  android.text.method

  android.text.style

  android.text.util

  android.transition

  android.util

  android.view

  android.view.accessibility

  android.view.animation

  android.view.inputmethod

  android.view.textservice

  android.webkit

  android.widget

  com.android.internal.backup

  com.android.internal.logging

  com.android.internal.os

  com.android.internal.statusbar

  com.android.internal.widget

  com.android.test.runner

  dalvik.annotation

  dalvik.bytecode

  dalvik.system

  java.awt.font

  java.beans

  java.io

  java.lang

  java.lang.annotation

  java.lang.ref

  java.lang.reflect

  java.math

  java.net

  java.nio

  java.nio.channels

  java.nio.channels.spi

  java.nio.charset

  java.nio.charset.spi

  java.security

  java.security.acl

  java.security.cert

  java.security.interfaces

  java.security.spec

  java.sql

  java.text

  java.util

  java.util.concurrent

  java.util.concurrent.atomic

  java.util.concurrent.locks

  java.util.jar

  java.util.logging

  java.util.prefs

  java.util.regex

  java.util.zip

  javax.crypto

  javax.crypto.interfaces

  javax.crypto.spec

  javax.microedition.khronos.egl

  javax.microedition.khronos.opengles

  javax.net

  javax.net.ssl

  javax.security.auth

  javax.security.auth.callback

  javax.security.auth.login

  javax.security.auth.x500

  javax.security.cert

  javax.sql

  javax.xml

  javax.xml.datatype

  javax.xml.namespace

  javax.xml.parsers

  javax.xml.transform

  javax.xml.transform.dom

  javax.xml.transform.sax

  javax.xml.transform.stream

  javax.xml.validation

  javax.xml.xpath

  junit.framework

  junit.runner

  org.apache.http.conn

  org.apache.http.conn.scheme

  org.apache.http.conn.ssl

  org.apache.http.params

  org.json

  org.w3c.dom

  org.w3c.dom.ls

  org.xml.sax

  org.xml.sax.ext

  org.xml.sax.helpers

  org.xmlpull.v1

  org.xmlpull.v1.sax2

Interfaces

BlockingDeque

BlockingQueue

Callable

CompletionService

ConcurrentMap

ConcurrentNavigableMap

Delayed

Executor

ExecutorService

ForkJoinPool.ForkJoinWorkerThreadFactory

ForkJoinPool.ManagedBlocker

Future

RejectedExecutionHandler

RunnableFuture

RunnableScheduledFuture

ScheduledExecutorService

ScheduledFuture

ThreadFactory

TransferQueue

Classes

AbstractExecutorService

ArrayBlockingQueue

ConcurrentHashMap

ConcurrentLinkedDeque

ConcurrentLinkedQueue

ConcurrentSkipListMap

ConcurrentSkipListSet

CopyOnWriteArrayList

CopyOnWriteArraySet

CountDownLatch

CyclicBarrier

DelayQueue

Exchanger

ExecutorCompletionService

Executors

ForkJoinPool

ForkJoinTask

ForkJoinWorkerThread

FutureTask

LinkedBlockingDeque

LinkedBlockingQueue

LinkedTransferQueue

Phaser

PriorityBlockingQueue

RecursiveAction

RecursiveTask

ScheduledThreadPoolExecutor

Semaphore

SynchronousQueue

ThreadLocalRandom

ThreadPoolExecutor

ThreadPoolExecutor.AbortPolicy

ThreadPoolExecutor.CallerRunsPolicy

ThreadPoolExecutor.DiscardOldestPolicy

ThreadPoolExecutor.DiscardPolicy

Enums

TimeUnit

Exceptions

BrokenBarrierException

CancellationException

ExecutionException

RejectedExecutionException

TimeoutException

      fullscreen
      Use Tree NavigationUse Panel Navigation

Summary:

  Methods

  | Inherited Methods

| [Expand All]

  Added in API level 1

    public

    interface

BlockingQueue

      implements

        Queue<E>

        java.util.concurrent.BlockingQueue<E>

  Known Indirect Subclasses

              ArrayBlockingQueue<E>,

              BlockingDeque<E>,

              DelayQueue<E extends Delayed>,

              LinkedBlockingDeque<E>,

              LinkedBlockingQueue<E>,

              LinkedTransferQueue<E>,

              PriorityBlockingQueue<E>,

              SynchronousQueue<E>,

              TransferQueue<E>

        ArrayBlockingQueue<E>

          A bounded blocking queue backed by an
 array.

        BlockingDeque<E>

          A Deque that additionally supports blocking operations that wait
 for the deque to become non-empty when retrieving an element, and wait for
 space to become available in the deque when storing an element.

        DelayQueue<E extends Delayed>

          An unbounded blocking queue of
 Delayed elements, in which an element can only be taken
 when its delay has expired.

        LinkedBlockingDeque<E>

          An optionally-bounded blocking deque based on
 linked nodes.

        LinkedBlockingQueue<E>

          An optionally-bounded blocking queue based on
 linked nodes.

        LinkedTransferQueue<E>

          An unbounded TransferQueue based on linked nodes.

        PriorityBlockingQueue<E>

          An unbounded blocking queue that uses
 the same ordering rules as class PriorityQueue and supplies
 blocking retrieval operations.

        SynchronousQueue<E>

          A blocking queue in which each insert
 operation must wait for a corresponding remove operation by another
 thread, and vice versa.

        TransferQueue<E>

          A BlockingQueue in which producers may wait for consumers
 to receive elements.

Class Overview

A Queue that additionally supports operations
 that wait for the queue to become non-empty when retrieving an
 element, and wait for space to become available in the queue when
 storing an element.

BlockingQueue methods come in four forms, with different ways
 of handling operations that cannot be satisfied immediately, but may be
 satisfied at some point in the future:
 one throws an exception, the second returns a special value (either
 null or false, depending on the operation), the third
 blocks the current thread indefinitely until the operation can succeed,
 and the fourth blocks for only a given maximum time limit before giving
 up.  These methods are summarized in the following table:

Summary of BlockingQueue methods

    Throws exception
    Special value
    Blocks
    Times out

    Insert
    add(e)
    offer(e)
    put(e)
    offer(e, time, unit)

    Remove
    remove()
    poll()
    take()
    poll(time, unit)

    Examine
    element()
    peek()
    not applicable
    not applicable

A BlockingQueue does not accept null elements.
 Implementations throw NullPointerException on attempts
 to add, put or offer a null.  A
 null is used as a sentinel value to indicate failure of
 poll operations.

A BlockingQueue may be capacity bounded. At any given
 time it may have a remainingCapacity beyond which no
 additional elements can be put without blocking.
 A BlockingQueue without any intrinsic capacity constraints always
 reports a remaining capacity of Integer.MAX_VALUE.

BlockingQueue implementations are designed to be used
 primarily for producer-consumer queues, but additionally support
 the Collection interface.  So, for example, it is
 possible to remove an arbitrary element from a queue using
 remove(x). However, such operations are in general
 not performed very efficiently, and are intended for only
 occasional use, such as when a queued message is cancelled.

BlockingQueue implementations are thread-safe.  All
 queuing methods achieve their effects atomically using internal
 locks or other forms of concurrency control. However, the
 bulk Collection operations addAll,
 containsAll, retainAll and removeAll are
 not necessarily performed atomically unless specified
 otherwise in an implementation. So it is possible, for example, for
 addAll(c) to fail (throwing an exception) after adding
 only some of the elements in c.

A BlockingQueue does not intrinsically support
 any kind of "close" or "shutdown" operation to
 indicate that no more items will be added.  The needs and usage of
 such features tend to be implementation-dependent. For example, a
 common tactic is for producers to insert special
 end-of-stream or poison objects, that are
 interpreted accordingly when taken by consumers.

 Usage example, based on a typical producer-consumer scenario.
 Note that a BlockingQueue can safely be used with multiple
 producers and multiple consumers.

 class Producer implements Runnable {
   private final BlockingQueue queue;
   Producer(BlockingQueue q) { queue = q;
   public void run() {
     try {
       while (true) { queue.put(produce()); }
     } catch (InterruptedException ex) { ... handle ...}
   }
   Object produce() { ... }
 }

 class Consumer implements Runnable {
   private final BlockingQueue queue;
   Consumer(BlockingQueue q) { queue = q; }
   public void run() {
     try {
       while (true) { consume(queue.take()); }
     } catch (InterruptedException ex) { ... handle ...}
   }
   void consume(Object x) { ... }
 }

 class Setup {
   void main() {
     BlockingQueue q = new SomeQueueImplementation();
     Producer p = new Producer(q);
     Consumer c1 = new Consumer(q);
     Consumer c2 = new Consumer(q);
     new Thread(p).start();
     new Thread(c1).start();
     new Thread(c2).start();
   }
 }}

Memory consistency effects: As with other concurrent
 collections, actions in a thread prior to placing an object into a
 BlockingQueue
 happen-before
 actions subsequent to the access or removal of that element from
 the BlockingQueue in another thread.

Summary

Public Methods

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        add(E e)</nobr>

          Inserts the specified element into this queue if it is possible to do
 so immediately without violating capacity restrictions, returning
 true upon success and throwing an
 IllegalStateException if no space is currently available.

        <nobr>
            abstract

            boolean</nobr>

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

          Returns true if this queue contains the specified element.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        <a href="../../../../reference/java/util/concurrent/BlockingQueue.html#drainTo(java.util.Collection<? super E>)">drainTo(Collection<? super E> c)</nobr>

          Removes all available elements from this queue and adds them
 to the given collection.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        <a href="../../../../reference/java/util/concurrent/BlockingQueue.html#drainTo(java.util.Collection<? super E>, int)">drainTo(Collection<? super E> c, int maxElements)</nobr>

          Removes at most the given number of available elements from
 this queue and adds them to the given collection.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        offer(E e, long timeout, TimeUnit unit)</nobr>

          Inserts the specified element into this queue, waiting up to the
 specified wait time if necessary for space to become available.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        offer(E e)</nobr>

          Inserts the specified element into this queue if it is possible to do
 so immediately without violating capacity restrictions, returning
 true upon success and false if no space is currently
 available.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        poll(long timeout, TimeUnit unit)</nobr>

          Retrieves and removes the head of this queue, waiting up to the
 specified wait time if necessary for an element to become available.

        <nobr>
            abstract

            void</nobr>

        <nobr>
        put(E e)</nobr>

          Inserts the specified element into this queue, waiting if necessary
 for space to become available.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        remainingCapacity()</nobr>

          Returns the number of additional elements that this queue can ideally
 (in the absence of memory or resource constraints) accept without
 blocking, or Integer.MAX_VALUE if there is no intrinsic
 limit.

        <nobr>
            abstract

            boolean</nobr>

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

          Removes a single instance of the specified element from this queue,
 if it is present.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        take()</nobr>

          Retrieves and removes the head of this queue, waiting if necessary
 until an element becomes available.

  [Expand]

Inherited Methods

From interface

  java.util.Queue

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        add(E e)</nobr>

          Inserts the specified element into this queue if it is possible to do so
 immediately without violating capacity restrictions, returning
 <tt>true</tt> upon success and throwing an <tt>IllegalStateException</tt>
 if no space is currently available.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        element()</nobr>

          Retrieves, but does not remove, the head of this queue.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        offer(E e)</nobr>

          Inserts the specified element into this queue if it is possible to do
 so immediately without violating capacity restrictions.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        peek()</nobr>

          Retrieves, but does not remove, the head of this queue,
 or returns <tt>null</tt> if this queue is empty.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        poll()</nobr>

          Retrieves and removes the head of this queue,
 or returns <tt>null</tt> if this queue is empty.

        <nobr>
            abstract

            E</nobr>

        <nobr>
        remove()</nobr>

          Retrieves and removes the head of this queue.

From interface

  java.util.Collection

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        add(E object)</nobr>

          Attempts to add object to the contents of this
 Collection (optional).

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        <a href="../../../../reference/java/util/Collection.html#addAll(java.util.Collection<? extends E>)">addAll(Collection<? extends E> collection)</nobr>

          Attempts to add all of the objects contained in Collection
 to the contents of this Collection (optional).

        <nobr>
            abstract

            void</nobr>

        <nobr>
        clear()</nobr>

          Removes all elements from this Collection, leaving it empty (optional).

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        contains(Object object)</nobr>

          Tests whether this Collection contains the specified object.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        <a href="../../../../reference/java/util/Collection.html#containsAll(java.util.Collection<?>)">containsAll(Collection<?> collection)</nobr>

          Tests whether this Collection contains all objects contained in the
 specified Collection.

        <nobr>
            abstract

            boolean</nobr>

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

          Compares the argument to the receiver, and returns true if they represent
 the same object using a class specific comparison.

        <nobr>
            abstract

            int</nobr>

        <nobr>
        hashCode()</nobr>

          Returns an integer hash code for the receiver.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        isEmpty()</nobr>

          Returns if this Collection contains no elements.

        <nobr>
            abstract

            Iterator<E></nobr>

        <nobr>
        iterator()</nobr>

          Returns an instance of Iterator that may be used to access the
 objects contained by this Collection.

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        remove(Object object)</nobr>

          Removes one instance of the specified object from this Collection if one
 is contained (optional).

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        <a href="../../../../reference/java/util/Collection.html#removeAll(java.util.Collection<?>)">removeAll(Collection<?> collection)</nobr>

          Removes all occurrences in this Collection of each object in the
 specified Collection (optional).

        <nobr>
            abstract

            boolean</nobr>

        <nobr>
        <a href="../../../../reference/java/util/Collection.html#retainAll(java.util.Collection<?>)">retainAll(Collection<?> collection)</nobr>

          Removes all objects from this Collection that are not also found in the
 Collection passed (optional).

        <nobr>
            abstract

            int</nobr>

        <nobr>
        size()</nobr>

          Returns a count of how many objects this Collection contains.

        <nobr>
            abstract

            <T>
            T[]</nobr>

        <nobr>
        toArray(T[] array)</nobr>

          Returns an array containing all elements contained in this Collection.

        <nobr>
            abstract

            Object[]</nobr>

        <nobr>
        toArray()</nobr>

          Returns a new array containing all elements contained in this Collection.

From interface

  java.lang.Iterable

        <nobr>
            abstract

            Iterator<E></nobr>

        <nobr>
        iterator()</nobr>

          Returns an Iterator for the elements in this object.

Public Methods

        public

        abstract

        boolean

      add
      (E e)

  Added in API level 1

Inserts the specified element into this queue if it is possible to do
 so immediately without violating capacity restrictions, returning
 true upon success and throwing an
 IllegalStateException if no space is currently available.
 When using a capacity-restricted queue, it is generally preferable to
 use offer.

Parameters

          e
          the element to add

Returns

true (as specified by add(E))

Throws

            IllegalStateException
            if the element cannot be added at this
         time due to capacity restrictions

            ClassCastException
            if the class of the specified element
         prevents it from being added to this queue

            NullPointerException
            if the specified element is null

            IllegalArgumentException
            if some property of the specified
         element prevents it from being added to this queue

        public

        abstract

        boolean

      contains
      (Object o)

  Added in API level 5

Returns true if this queue contains the specified element.
 More formally, returns true if and only if this queue contains
 at least one element e such that o.equals(e).

Parameters

          o
          object to be checked for containment in this queue

Returns

true if this queue contains the specified element

Throws

            ClassCastException
            if the class of the specified element
         is incompatible with this queue
         (optional)

            NullPointerException
            if the specified element is null
         (optional)

<A NAME="drainTo(java.util.Collection<? super E>)">

        public

        abstract

        int

      drainTo
      (Collection<? super E> c)

  Added in API level 1

Removes all available elements from this queue and adds them
 to the given collection.  This operation may be more
 efficient than repeatedly polling this queue.  A failure
 encountered while attempting to add elements to
 collection c may result in elements being in neither,
 either or both collections when the associated exception is
 thrown.  Attempts to drain a queue to itself result in
 IllegalArgumentException. Further, the behavior of
 this operation is undefined if the specified collection is
 modified while the operation is in progress.

Parameters

          c
          the collection to transfer elements into

Returns

the number of elements transferred

Throws

            UnsupportedOperationException
            if addition of elements
         is not supported by the specified collection

            ClassCastException
            if the class of an element of this queue
         prevents it from being added to the specified collection

            NullPointerException
            if the specified collection is null

            IllegalArgumentException
            if the specified collection is this
         queue, or some property of an element of this queue prevents
         it from being added to the specified collection

<A NAME="drainTo(java.util.Collection<? super E>, int)">

        public

        abstract

        int

      drainTo
      (Collection<? super E> c, int maxElements)

  Added in API level 1

Removes at most the given number of available elements from
 this queue and adds them to the given collection.  A failure
 encountered while attempting to add elements to
 collection c may result in elements being in neither,
 either or both collections when the associated exception is
 thrown.  Attempts to drain a queue to itself result in
 IllegalArgumentException. Further, the behavior of
 this operation is undefined if the specified collection is
 modified while the operation is in progress.

Parameters

          c
          the collection to transfer elements into

          maxElements
          the maximum number of elements to transfer

Returns

the number of elements transferred

Throws

            UnsupportedOperationException
            if addition of elements
         is not supported by the specified collection

            ClassCastException
            if the class of an element of this queue
         prevents it from being added to the specified collection

            NullPointerException
            if the specified collection is null

            IllegalArgumentException
            if the specified collection is this
         queue, or some property of an element of this queue prevents
         it from being added to the specified collection

        public

        abstract

        boolean

      offer
      (E e, long timeout, TimeUnit unit)

  Added in API level 1

Inserts the specified element into this queue, waiting up to the
 specified wait time if necessary for space to become available.

Parameters

          e
          the element to add

          timeout
          how long to wait before giving up, in units of
        unit

          unit
          a TimeUnit determining how to interpret the
        timeout parameter

Returns

true if successful, or false if
         the specified waiting time elapses before space is available

Throws

            InterruptedException
            if interrupted while waiting

            ClassCastException
            if the class of the specified element
         prevents it from being added to this queue

            NullPointerException
            if the specified element is null

            IllegalArgumentException
            if some property of the specified
         element prevents it from being added to this queue

        public

        abstract

        boolean

      offer
      (E e)

  Added in API level 1

Inserts the specified element into this queue if it is possible to do
 so immediately without violating capacity restrictions, returning
 true upon success and false if no space is currently
 available.  When using a capacity-restricted queue, this method is
 generally preferable to add(E), which can fail to insert an
 element only by throwing an exception.

Parameters

          e
          the element to add

Returns

true if the element was added to this queue, else
         false

Throws

            ClassCastException
            if the class of the specified element
         prevents it from being added to this queue

            NullPointerException
            if the specified element is null

            IllegalArgumentException
            if some property of the specified
         element prevents it from being added to this queue

        public

        abstract

        E

      poll
      (long timeout, TimeUnit unit)

  Added in API level 1

Retrieves and removes the head of this queue, waiting up to the
 specified wait time if necessary for an element to become available.

Parameters

          timeout
          how long to wait before giving up, in units of
        unit

          unit
          a TimeUnit determining how to interpret the
        timeout parameter

Returns

the head of this queue, or null if the
         specified waiting time elapses before an element is available

Throws

            InterruptedException
            if interrupted while waiting

        public

        abstract

        void

      put
      (E e)

  Added in API level 1

Inserts the specified element into this queue, waiting if necessary
 for space to become available.

Parameters

          e
          the element to add

Throws

            InterruptedException
            if interrupted while waiting

            ClassCastException
            if the class of the specified element
         prevents it from being added to this queue

            NullPointerException
            if the specified element is null

            IllegalArgumentException
            if some property of the specified
         element prevents it from being added to this queue

        public

        abstract

        int

      remainingCapacity
      ()

  Added in API level 1

Returns the number of additional elements that this queue can ideally
 (in the absence of memory or resource constraints) accept without
 blocking, or Integer.MAX_VALUE if there is no intrinsic
 limit.

Note that you cannot always tell if an attempt to insert
 an element will succeed by inspecting remainingCapacity
 because it may be the case that another thread is about to
 insert or remove an element.

Returns

the remaining capacity

        public

        abstract

        boolean

      remove
      (Object o)

  Added in API level 5

Removes a single instance of the specified element from this queue,
 if it is present.  More formally, removes an element e such
 that o.equals(e), if this queue contains one or more such
 elements.
 Returns true if this queue contained the specified element
 (or equivalently, if this queue changed as a result of the call).

Parameters

          o
          element to be removed from this queue, if present

Returns

true if this queue changed as a result of the call

Throws

            ClassCastException
            if the class of the specified element
         is incompatible with this queue
         (optional)

            NullPointerException
            if the specified element is null
         (optional)

        public

        abstract

        E

      take
      ()

  Added in API level 1

Retrieves and removes the head of this queue, waiting if necessary
 until an element becomes available.

Returns

the head of this queue

Throws

            InterruptedException
            if interrupted while waiting

        Get news & tips

          Blog
          Support

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

    Android 6.0 r1 —

      About Android
      Auto
      TV
      Wear
      Legal

        <select name="language" onchange="changeLangPref(this.value, true)">
          <option value="en" selected="selected">English</option>
          <option value="es">Español</option>
          <option value="ja">日本語</option>
          <option value="ko">한국어</option>
          <option value="pt-br">Português Brasileiro</option>
          <option value="ru">Русский</option>
          <option value="zh-cn">中文(简体)</option>
          <option value="zh-tw">中文(繁體)</option>
        </select>

        <button class="dac-modal-header-close" data-modal-toggle></button>

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

          <form action="https://docs.google.com/forms/d/1QgnkzbEJIDu9lMEea0mxqWrXUJu0oBCLD7ar23V0Yys/formResponse" class="dac-form" method="post" target="dac-newsletter-iframe">

              <fieldset class="dac-form-fieldset">

                      Full name
                      <input type="text" class="dac-form-input" name="entry.1357890476" id="newsletter-full-name" required>
                      *

                      Email address
                      <input type="email" class="dac-form-input" name="entry.472100832" id="newsletter-email" required>
                      *

                      Company / developer name
                      <input type="text" class="dac-form-input" name="entry.1664780309" id="newsletter-company">

                      One of your Play Store app URLs
                      <input type="url" class="dac-form-input" name="entry.47013838" id="newsletter-play-store" required>
                      *

              </fieldset>
              <fieldset class="dac-form-fieldset">

                    <legend class="dac-form-legend">Which best describes your business:*
                    </legend>

                      <input type="radio" value="Apps" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-app" required>

                      Apps

                      <input type="radio" value="Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-games" required>

                      Games

                      <input type="radio" value="Apps and Games" class="dac-form-radio" name="entry.1796324055" id="newsletter-business-type-appsgames" required>

                      Apps & Games

                          <input type="checkbox" class="dac-form-checkbox" name="entry.732309842" id="newsletter-add" required value="Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.">

                          Add me to the mailing list for the monthly newsletter and occasional emails about development and Google Play opportunities.*

                          <input type="checkbox" class="dac-form-checkbox" name="entry.2045036090" id="newsletter-terms" required value="I acknowledge that the information provided in this form will be subject to Google's privacy policy (https://www.google.com/policies/privacy/).">

                          I acknowledge that the information provided in this form will be subject to Google's privacy policy.*

              </fieldset>

              <button type="submit" value="Submit" class="dac-fab dac-primary dac-large dac-modal-action"></button>

          </form>

              You have successfully signed up for the latest Android developer news and tips.


text:
layout: page
title: Massey Trade Party
date: 2016-05-24
author: Kathy Escobar
tags: weekly links, java
status: published
summary: Nulla quis consectetur dolor. Curabitur erat lectus, dapibus ut dolor.
banner: images/banner/office-01.jpg
booking:
  startDate: 02/18/2019
  endDate: 02/20/2019
  ctyhocn: DUAOKHX
  groupCode: MTP
published: true
---
Pellentesque auctor tincidunt enim id bibendum. Aenean id aliquet lacus, ut tincidunt nulla. Suspendisse mauris ex, euismod et viverra ornare, pellentesque nec felis. Morbi lobortis velit dolor, efficitur pellentesque magna pellentesque eget. Nam sed scelerisque quam. Aliquam ac rhoncus lacus. Aliquam venenatis semper bibendum.
Integer imperdiet tortor vitae quam aliquet, a auctor ligula congue. Nam non nibh viverra, blandit nisi nec, mattis risus. Vivamus eros nibh, fermentum sit amet aliquet gravida, tincidunt nec massa. Cras ultrices elit sed libero convallis ultricies. Nam pharetra dapibus eros. In gravida accumsan convallis. Morbi facilisis felis aliquam pellentesque tristique. Duis nunc sapien, gravida non consectetur ac, imperdiet vitae ligula. Morbi ac varius lectus. Nullam ut sapien viverra, pretium ex nec, pellentesque mi. Morbi dignissim, nisi ac blandit vestibulum, ipsum nisi tincidunt metus, non imperdiet metus nibh a orci. Curabitur vel sollicitudin eros. Vestibulum volutpat tincidunt est, at tristique libero pulvinar quis. Cras consequat velit eu sem tempus interdum. In pretium erat a feugiat lacinia.

* Quisque eget enim eu lectus convallis accumsan et non elit.

Proin dictum odio metus, eu porta ante facilisis non. Donec sodales ex quam, id vehicula sem dapibus ac. Nulla et nisl id lacus condimentum ornare sit amet tincidunt libero. Ut nulla tortor, mattis vel tellus sit amet, lacinia convallis metus. Nunc auctor nisi ac nisl bibendum, a laoreet elit interdum. Nulla facilisi. Mauris ipsum nisi, interdum et mattis sed, commodo sed ex. Praesent et ante et neque dignissim rhoncus eget et magna.


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
Phytologia 77:294. 1995 ("1994")

#### Original name
Tripolium tenuifolium Phil.

### Remarks
null


text:
<!DOCTYPE html>

Exercises -webkit-box with various box-pack settings when rtl. In all cases
   the order of letters in the boxes should be alphabetized left to right.

Start. Boxes should be aligned to right side.

B

A

Centered. Boxes should be centered.

B

A

End. Boxes should be aligned to left side.

B

A

Start, content too big. Boxes should start at left edge and extend
   outside border.

A

B

C

D

Center, content too big. Boxes should start at left edge and extend
   outside border.

A

B

C

D

End, content too big. Boxes should start at left edge and extend
   outside border.

A

B

C

D


text:
General

            Al registar cuenta en Hubzilla, también ha creado un perfil y un canal.

Cuenta

            Tiene una cuenta. Esta consta de su correo electrónico y su contraseña. Mediante su cuenta, accede a su
            perfil y su canal. Piense en su cuenta como la vía para identificarse en un sitio Hubzilla. Le permite
            hacer cosas, como crear perfiles y canales a través de los cuelas podrá conectar con otra gente.

Perfil

            Usted está registrado, seguramente, con algunos otros servicios de Internet, como foros o comunidades en línea. Para todos ellos
            usted proporcionó algún tipo de información sobre usted mismo, tal como su fecha de nacimiento, país, edad y gustos o preferencias. Frente a otros
            servicios, Hubzilla le ofrece la ventaja de crear
            muchos más perfiles. De esa manera usted puede distinguir entre los perfiles dirigidos especialmente a todo el mundo
            (su perfil público), Sus compañeros de trabajo, su familia y su pareja.Piense en su perfil como la información básica
            básica que acerca de usted mismo muestra a otra gente,

Canal

            Durante el registro, creó su primer canal. Sí, además de los varios perfiles, usted puede tener
            varios canales. Esto podría ser un poco confuso al principio, pero vamos a aclarar las cosas. Usted ya ha creado
            un canal. Puede usarlo para el público en general, para informar a los demás sobre su vida cotidiana. Pero
            Tal vez usted es un ávido lector de libros y muchas personas se aburren con eso. Así que abre un segundo canal sólo
            para los amantes de los libros, en el que todos ustedes pueden hablar de libros tanto como quieran. Obviamente, este es un nuevo flujo de
            entradas, con un nuevo perfil (...o nuevos perfiles...) y contactos completamente diferentes. Algunas conexiones
            pueden existir en ambos canales, pero habrá algunas que estén exclusivamente en uno de los dos. Usted mismo simplemente
            cambie entre ambos como cambia de interlocutor en el mundo real cuando habla con varias personas en la calle
            o personas con las que se reúne especialmente para hablar de libros. Incluso puede conectarse a sí mismo, o mejor: a su otro
            canal. :) Piense en un canal como en diferentes espacios dedicados a diferentes temas en los que puede hablar con diferentes
            personas.


text:
module TwitterAds
  class TargetingCriteria

    include TwitterAds::DSL
    include TwitterAds::Persistence
    include TwitterAds::Resource::InstanceMethods
    include TwitterAds::Batch

    attr_reader :account

    property :id, read_only: true
    property :name, read_only: true
    property :localized_name, read_only: true
    property :created_at, type: :time, read_only: true
    property :updated_at, type: :time, read_only: true
    property :deleted, type: :bool, read_only: true

    property :line_item_id
    property :targeting_type
    property :targeting_value
    property :tailored_audience_expansion, type: :bool
    property :tailored_audience_type
    property :location_type

    # sdk only
    property :to_delete, type: :bool

    RESOURCE_COLLECTION = "/#{TwitterAds::API_VERSION}/" +
                          'accounts/%{account_id}/targeting_criteria'.freeze # @api private
    RESOURCE_BATCH      = "/#{TwitterAds::API_VERSION}/" +
                          'batch/accounts/%{account_id}/targeting_criteria'.freeze # @api private
    RESOURCE            = "/#{TwitterAds::API_VERSION}/" +
                          'accounts/%{account_id}/targeting_criteria/%{id}'.freeze # @api private

    def initialize(account)
      @account = account
      self
    end

    class << self

      # Returns a Cursor instance for a given resource.
      #
      # @param account [Account] The Account object instance.
      # @param line_item_id [String] The line item ID string.
      # @param opts [Hash] An optional Hash of extended options.
      # @option opts [Boolean] :with_deleted Indicates if deleted items should be included.
      # @option opts [String] :sort_by The object param to sort the API response by.
      #
      # @return [Cursor] A Cusor object ready to iterate through the API response.
      #
      # @since 0.3.1
      # @see Cursor
      # @see https://dev.twitter.com/ads/basics/sorting Sorting
      def all(account, line_item_id, opts = {})
        params = { line_item_id: line_item_id }.merge!(opts)
        resource = RESOURCE_COLLECTION % { account_id: account.id }
        request = Request.new(account.client, :get, resource, params: params)
        Cursor.new(self, request, init_with: [account])
      end

      # Returns an object instance for a given resource.
      #
      # @param account [Account] The Account object instance.
      # @param id [String] The ID of the specific object to be loaded.
      # @param opts [Hash] An optional Hash of extended options.
      # @option opts [Boolean] :with_deleted Indicates if deleted items should be included.
      # @option opts [String] :sort_by The object param to sort the API response by.
      #
      # @return [self] The object instance for the specified resource.
      #
      # @since 0.3.1
      def load(account, id, opts = {})
        params   = { with_deleted: true }.merge!(opts)
        resource = RESOURCE % { account_id: account.id, id: id }
        response = Request.new(account.client, :get, resource, params: params).perform
        new(account).from_response(response.body[:data])
      end

    end

  end
end


text:
'use strict';

var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var Complex64 = require( '@stdlib/complex/float32' );
var cidentityf = require( './../lib' );

var z;
var i;
for ( i = 0; i < 100; i++ ) {
	z = new Complex64( discreteUniform( -50, 50 ), discreteUniform( -50, 50 ) );
	console.log( 'identity(%s) = %s', z, cidentityf( z ) );
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Cercosporella epimedii Siemaszko

### Remarks
null


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

namespace Ploeh.AutoFixture.Kernel
{
    /// <summary>
    /// Tracks all disposable specimens created by a decorated <see cref="ISpecimenBuilder"/> to
    /// be able to dispose them when signalled.
    /// </summary>
    /// <remarks>
    /// <para>
    /// The DisposableTracker examines all specimens created by a decorated
    /// <see cref="ISpecimenBuilder"/>. All specimens that implement <see cref="IDisposable"/> are
    /// tracked so that they can be deterministically disposed. This happens when
    /// <see cref="Dispose()"/> is invoked on the instance.
    /// </para>
    /// </remarks>
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The main responsibility of this class isn't to be a 'collection' (which, by the way, it isn't - it's just an Iterator).")]
    public class DisposableTracker : ISpecimenBuilderNode, IDisposable
    {
        private readonly ISpecimenBuilder builder;
        private readonly HashSet<IDisposable> disposables;

        /// <summary>
        /// Initializes a new instance of the <see cref="DisposableTracker"/> class.
        /// </summary>
        /// <param name="builder">The decorated builder.</param>
        /// <remarks>
        /// <para>
        /// After initilization, <paramref name="builder"/> is availble through the
        /// <see cref="Builder"/> property.
        /// </para>
        /// </remarks>
        public DisposableTracker(ISpecimenBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException("builder");
            }

            this.builder = builder;
            this.disposables = new HashSet<IDisposable>();
        }

        /// <summary>
        /// Gets the decorated builder.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This property exposes the decorated builder originally supplied to the constructor.
        /// </para>
        /// </remarks>
        /// <seealso cref="DisposableTracker(ISpecimenBuilder)"/>
        public ISpecimenBuilder Builder
        {
            get { return this.builder; }
        }

        /// <summary>
        /// Gets the disposable specimens currently tracked by this instance.
        /// </summary>
        /// <remarks>
        /// <para>
        /// Items are added to this list by the <see cref="Create(object, ISpecimenContext)"/>
        /// method.
        /// </para>
        /// </remarks>
        public IEnumerable<IDisposable> Disposables
        {
            get { return this.disposables; }
        }

        /// <summary>
        /// Creates a new specimen based on a request.
        /// </summary>
        /// <param name="request">The request that describes what to create.</param>
        /// <param name="context">A context that can be used to create other specimens.</param>
        /// <returns>
        /// The specimen created by the decorated builder.
        /// </returns>
        /// <remarks>
        /// <para>
        /// This method delegates creation of specimens to the decorated <see cref="Builder"/>.
        /// However, before specimens are returned they are examined and tracked in the
        /// <see cref="Disposables"/> list if they implement <see cref="IDisposable"/>. They can
        /// subsequently be disposed by invoking the <see cref="Dispose()"/> method on the
        /// instance.
        /// </para>
        /// </remarks>
        public object Create(object request, ISpecimenContext context)
        {
            var specimen = this.Builder.Create(request, context);
            var d = specimen as IDisposable;
            if (d != null)
            {
                this.disposables.Add(d);
            }
            return specimen;
        }

        /// <summary>Composes the supplied builders.</summary>
        /// <param name="builders">The builders to compose.</param>
        /// <returns>
        /// A new <see cref="ISpecimenBuilderNode" /> instance containing
        /// <paramref name="builders" /> as child nodes.
        /// </returns>
        public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
        {
            var composedBuilder = CompositeSpecimenBuilder.ComposeIfMultiple(builders);
            var d = new DisposableTracker(composedBuilder);
            this.disposables.Add(d);
            return d;
        }

        /// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>
        /// A <see cref="IEnumerator{ISpecimenBuilder}" /> that can be used to
        /// iterate through the collection.
        /// </returns>
        public IEnumerator<ISpecimenBuilder> GetEnumerator()
        {
            yield return this.builder;
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.GetEnumerator();
        }

        /// <summary>
        /// Disposes all items in the <see cref="Disposables"/> list and removes them from the
        /// list.
        /// </summary>
        public void Dispose()
        {
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }

        /// <summary>
        /// Disposes all items in the <see cref="Disposables"/> list and removes them from the
        /// list.
        /// </summary>
        /// <param name="disposing">
        /// <see langword="true"/> to release both managed and unmanaged resources;
        /// <see langword="false"/> to release only unmanaged resources.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                foreach(var d in this.Disposables)
                {
                    d.Dispose();
                }
                this.disposables.Clear();
            }
        }
    }
}