text:
<?php

namespace DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation;

use DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement;
use DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept;
use DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRDateTime;
use DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRPositiveInt;
use DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference;
use DCarbone\PHPFHIRGenerated\STU3\PHPFHIRConstants;
use DCarbone\PHPFHIRGenerated\STU3\PHPFHIRTypeInterface;

/**
 * A patient's point-in-time immunization and recommendation (i.e. forecasting a
 * patient's immunization eligibility according to a published schedule) with
 * optional supporting justification.
 *
 * Class FHIRImmunizationRecommendationRecommendation
 * @package \DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation
 */
class FHIRImmunizationRecommendationRecommendation extends FHIRBackboneElement
{
    // name of FHIR type this class describes
    const FHIR_TYPE_NAME = PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION;
    const FIELD_DATE = 'date';
    const FIELD_DATE_EXT = '_date';
    const FIELD_DATE_CRITERION = 'dateCriterion';
    const FIELD_DOSE_NUMBER = 'doseNumber';
    const FIELD_DOSE_NUMBER_EXT = '_doseNumber';
    const FIELD_FORECAST_STATUS = 'forecastStatus';
    const FIELD_PROTOCOL = 'protocol';
    const FIELD_SUPPORTING_IMMUNIZATION = 'supportingImmunization';
    const FIELD_SUPPORTING_PATIENT_INFORMATION = 'supportingPatientInformation';
    const FIELD_TARGET_DISEASE = 'targetDisease';
    const FIELD_VACCINE_CODE = 'vaccineCode';

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

    /**
     * A date, date-time or partial date (e.g. just year or year + month). If hours and
     * minutes are specified, a time zone SHALL be populated. The format is a union of
     * the schema types gYear, gYearMonth, date and dateTime. Seconds must be provided
     * due to schema type constraints but may be zero-filled and may be ignored. Dates
     * SHALL be valid dates.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The date the immunization recommendation was created.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRDateTime
     */
    protected $date = null;

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Vaccine date recommendations. For example, earliest date to administer, latest
     * date to administer, etc.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationDateCriterion[]
     */
    protected $dateCriterion = [];

    /**
     * An integer with a value that is positive (e.g. >0)
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The next recommended dose number (e.g. dose 2 is the next recommended dose).
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRPositiveInt
     */
    protected $doseNumber = null;

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine administration status.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    protected $forecastStatus = null;

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Contains information about the protocol under which the vaccine was
     * administered.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationProtocol
     */
    protected $protocol = null;

    /**
     * A reference from one resource to another.
     * 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
     *
     * Immunization event history that supports the status and recommendation.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[]
     */
    protected $supportingImmunization = [];

    /**
     * A reference from one resource to another.
     * 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
     *
     * Patient Information that supports the status and recommendation. This includes
     * patient observations, adverse reactions and allergy/intolerance information.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[]
     */
    protected $supportingPatientInformation = [];

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * The targeted disease for the recommendation.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    protected $targetDisease = null;

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine that pertains to the recommendation.
     *
     * @var null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    protected $vaccineCode = null;

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

    /**
     * FHIRImmunizationRecommendationRecommendation Constructor
     * @param null|array $data
     */
    public function __construct($data = null)
    {
        if (null === $data || [] === $data) {
            return;
        }
        if (!is_array($data)) {
            throw new \InvalidArgumentException(sprintf(
                'FHIRImmunizationRecommendationRecommendation::_construct - $data expected to be null or array, %s seen',
                gettype($data)
            ));
        }
        parent::__construct($data);
        if (isset($data[self::FIELD_DATE]) || isset($data[self::FIELD_DATE_EXT])) {
            if (isset($data[self::FIELD_DATE])) {
                $value = $data[self::FIELD_DATE];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_DATE_EXT]) && is_array($data[self::FIELD_DATE_EXT])) {
                $ext = $data[self::FIELD_DATE_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRDateTime) {
                    $this->setDate($value);
                } else if (is_array($value)) {
                    $this->setDate(new FHIRDateTime(array_merge($ext, $value)));
                } else {
                    $this->setDate(new FHIRDateTime([FHIRDateTime::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setDate(new FHIRDateTime($ext));
            }
        }
        if (isset($data[self::FIELD_DATE_CRITERION])) {
            if (is_array($data[self::FIELD_DATE_CRITERION])) {
                foreach($data[self::FIELD_DATE_CRITERION] as $v) {
                    if (null === $v) {
                        continue;
                    }
                    if ($v instanceof FHIRImmunizationRecommendationDateCriterion) {
                        $this->addDateCriterion($v);
                    } else {
                        $this->addDateCriterion(new FHIRImmunizationRecommendationDateCriterion($v));
                    }
                }
            } else if ($data[self::FIELD_DATE_CRITERION] instanceof FHIRImmunizationRecommendationDateCriterion) {
                $this->addDateCriterion($data[self::FIELD_DATE_CRITERION]);
            } else {
                $this->addDateCriterion(new FHIRImmunizationRecommendationDateCriterion($data[self::FIELD_DATE_CRITERION]));
            }
        }
        if (isset($data[self::FIELD_DOSE_NUMBER]) || isset($data[self::FIELD_DOSE_NUMBER_EXT])) {
            if (isset($data[self::FIELD_DOSE_NUMBER])) {
                $value = $data[self::FIELD_DOSE_NUMBER];
            } else {
                $value = null;
            }
            if (isset($data[self::FIELD_DOSE_NUMBER_EXT]) && is_array($data[self::FIELD_DOSE_NUMBER_EXT])) {
                $ext = $data[self::FIELD_DOSE_NUMBER_EXT];
            } else {
                $ext = [];
            }
            if (null !== $value) {
                if ($value instanceof FHIRPositiveInt) {
                    $this->setDoseNumber($value);
                } else if (is_array($value)) {
                    $this->setDoseNumber(new FHIRPositiveInt(array_merge($ext, $value)));
                } else {
                    $this->setDoseNumber(new FHIRPositiveInt([FHIRPositiveInt::FIELD_VALUE => $value] + $ext));
                }
            } else if ([] !== $ext) {
                $this->setDoseNumber(new FHIRPositiveInt($ext));
            }
        }
        if (isset($data[self::FIELD_FORECAST_STATUS])) {
            if ($data[self::FIELD_FORECAST_STATUS] instanceof FHIRCodeableConcept) {
                $this->setForecastStatus($data[self::FIELD_FORECAST_STATUS]);
            } else {
                $this->setForecastStatus(new FHIRCodeableConcept($data[self::FIELD_FORECAST_STATUS]));
            }
        }
        if (isset($data[self::FIELD_PROTOCOL])) {
            if ($data[self::FIELD_PROTOCOL] instanceof FHIRImmunizationRecommendationProtocol) {
                $this->setProtocol($data[self::FIELD_PROTOCOL]);
            } else {
                $this->setProtocol(new FHIRImmunizationRecommendationProtocol($data[self::FIELD_PROTOCOL]));
            }
        }
        if (isset($data[self::FIELD_SUPPORTING_IMMUNIZATION])) {
            if (is_array($data[self::FIELD_SUPPORTING_IMMUNIZATION])) {
                foreach($data[self::FIELD_SUPPORTING_IMMUNIZATION] as $v) {
                    if (null === $v) {
                        continue;
                    }
                    if ($v instanceof FHIRReference) {
                        $this->addSupportingImmunization($v);
                    } else {
                        $this->addSupportingImmunization(new FHIRReference($v));
                    }
                }
            } else if ($data[self::FIELD_SUPPORTING_IMMUNIZATION] instanceof FHIRReference) {
                $this->addSupportingImmunization($data[self::FIELD_SUPPORTING_IMMUNIZATION]);
            } else {
                $this->addSupportingImmunization(new FHIRReference($data[self::FIELD_SUPPORTING_IMMUNIZATION]));
            }
        }
        if (isset($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION])) {
            if (is_array($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION])) {
                foreach($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION] as $v) {
                    if (null === $v) {
                        continue;
                    }
                    if ($v instanceof FHIRReference) {
                        $this->addSupportingPatientInformation($v);
                    } else {
                        $this->addSupportingPatientInformation(new FHIRReference($v));
                    }
                }
            } else if ($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION] instanceof FHIRReference) {
                $this->addSupportingPatientInformation($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION]);
            } else {
                $this->addSupportingPatientInformation(new FHIRReference($data[self::FIELD_SUPPORTING_PATIENT_INFORMATION]));
            }
        }
        if (isset($data[self::FIELD_TARGET_DISEASE])) {
            if ($data[self::FIELD_TARGET_DISEASE] instanceof FHIRCodeableConcept) {
                $this->setTargetDisease($data[self::FIELD_TARGET_DISEASE]);
            } else {
                $this->setTargetDisease(new FHIRCodeableConcept($data[self::FIELD_TARGET_DISEASE]));
            }
        }
        if (isset($data[self::FIELD_VACCINE_CODE])) {
            if ($data[self::FIELD_VACCINE_CODE] instanceof FHIRCodeableConcept) {
                $this->setVaccineCode($data[self::FIELD_VACCINE_CODE]);
            } else {
                $this->setVaccineCode(new FHIRCodeableConcept($data[self::FIELD_VACCINE_CODE]));
            }
        }
    }

    /**
     * @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 "<ImmunizationRecommendationRecommendation{$xmlns}></ImmunizationRecommendationRecommendation>";
    }

    /**
     * A date, date-time or partial date (e.g. just year or year + month). If hours and
     * minutes are specified, a time zone SHALL be populated. The format is a union of
     * the schema types gYear, gYearMonth, date and dateTime. Seconds must be provided
     * due to schema type constraints but may be zero-filled and may be ignored. Dates
     * SHALL be valid dates.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The date the immunization recommendation was created.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRDateTime
     */
    public function getDate()
    {
        return $this->date;
    }

    /**
     * A date, date-time or partial date (e.g. just year or year + month). If hours and
     * minutes are specified, a time zone SHALL be populated. The format is a union of
     * the schema types gYear, gYearMonth, date and dateTime. Seconds must be provided
     * due to schema type constraints but may be zero-filled and may be ignored. Dates
     * SHALL be valid dates.
     * If the element is present, it must have either a \@value, an \@id, or extensions
     *
     * The date the immunization recommendation was created.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRDateTime $date
     * @return static
     */
    public function setDate($date = null)
    {
        if (null === $date) {
            $this->date = null;
            return $this;
        }
        if ($date instanceof FHIRDateTime) {
            $this->date = $date;
            return $this;
        }
        $this->date = new FHIRDateTime($date);
        return $this;
    }

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Vaccine date recommendations. For example, earliest date to administer, latest
     * date to administer, etc.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationDateCriterion[]
     */
    public function getDateCriterion()
    {
        return $this->dateCriterion;
    }

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Vaccine date recommendations. For example, earliest date to administer, latest
     * date to administer, etc.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationDateCriterion $dateCriterion
     * @return static
     */
    public function addDateCriterion(FHIRImmunizationRecommendationDateCriterion $dateCriterion = null)
    {
        $this->dateCriterion[] = $dateCriterion;
        return $this;
    }

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Vaccine date recommendations. For example, earliest date to administer, latest
     * date to administer, etc.
     *
     * @param \DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationDateCriterion[] $dateCriterion
     * @return static
     */
    public function setDateCriterion(array $dateCriterion = [])
    {
        $this->dateCriterion = [];
        if ([] === $dateCriterion) {
            return $this;
        }
        foreach($dateCriterion as $v) {
            if ($v instanceof FHIRImmunizationRecommendationDateCriterion) {
                $this->addDateCriterion($v);
            } else {
                $this->addDateCriterion(new FHIRImmunizationRecommendationDateCriterion($v));
            }
        }
        return $this;
    }

    /**
     * An integer with a value that is positive (e.g. >0)
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The next recommended dose number (e.g. dose 2 is the next recommended dose).
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRPositiveInt
     */
    public function getDoseNumber()
    {
        return $this->doseNumber;
    }

    /**
     * An integer with a value that is positive (e.g. >0)
     * If the element is present, it must have either a \@value, an \@id referenced from
     * the Narrative, or extensions
     *
     * The next recommended dose number (e.g. dose 2 is the next recommended dose).
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRPositiveInt $doseNumber
     * @return static
     */
    public function setDoseNumber($doseNumber = null)
    {
        if (null === $doseNumber) {
            $this->doseNumber = null;
            return $this;
        }
        if ($doseNumber instanceof FHIRPositiveInt) {
            $this->doseNumber = $doseNumber;
            return $this;
        }
        $this->doseNumber = new FHIRPositiveInt($doseNumber);
        return $this;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine administration status.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    public function getForecastStatus()
    {
        return $this->forecastStatus;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine administration status.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept $forecastStatus
     * @return static
     */
    public function setForecastStatus(FHIRCodeableConcept $forecastStatus = null)
    {
        $this->forecastStatus = $forecastStatus;
        return $this;
    }

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Contains information about the protocol under which the vaccine was
     * administered.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationProtocol
     */
    public function getProtocol()
    {
        return $this->protocol;
    }

    /**
     * A patient's point-in-time immunization and recommendation (i.e. forecasting a
     * patient's immunization eligibility according to a published schedule) with
     * optional supporting justification.
     *
     * Contains information about the protocol under which the vaccine was
     * administered.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationProtocol $protocol
     * @return static
     */
    public function setProtocol(FHIRImmunizationRecommendationProtocol $protocol = null)
    {
        $this->protocol = $protocol;
        return $this;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Immunization event history that supports the status and recommendation.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[]
     */
    public function getSupportingImmunization()
    {
        return $this->supportingImmunization;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Immunization event history that supports the status and recommendation.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference $supportingImmunization
     * @return static
     */
    public function addSupportingImmunization(FHIRReference $supportingImmunization = null)
    {
        $this->supportingImmunization[] = $supportingImmunization;
        return $this;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Immunization event history that supports the status and recommendation.
     *
     * @param \DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[] $supportingImmunization
     * @return static
     */
    public function setSupportingImmunization(array $supportingImmunization = [])
    {
        $this->supportingImmunization = [];
        if ([] === $supportingImmunization) {
            return $this;
        }
        foreach($supportingImmunization as $v) {
            if ($v instanceof FHIRReference) {
                $this->addSupportingImmunization($v);
            } else {
                $this->addSupportingImmunization(new FHIRReference($v));
            }
        }
        return $this;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Patient Information that supports the status and recommendation. This includes
     * patient observations, adverse reactions and allergy/intolerance information.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[]
     */
    public function getSupportingPatientInformation()
    {
        return $this->supportingPatientInformation;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Patient Information that supports the status and recommendation. This includes
     * patient observations, adverse reactions and allergy/intolerance information.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference $supportingPatientInformation
     * @return static
     */
    public function addSupportingPatientInformation(FHIRReference $supportingPatientInformation = null)
    {
        $this->supportingPatientInformation[] = $supportingPatientInformation;
        return $this;
    }

    /**
     * A reference from one resource to another.
     * 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
     *
     * Patient Information that supports the status and recommendation. This includes
     * patient observations, adverse reactions and allergy/intolerance information.
     *
     * @param \DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRReference[] $supportingPatientInformation
     * @return static
     */
    public function setSupportingPatientInformation(array $supportingPatientInformation = [])
    {
        $this->supportingPatientInformation = [];
        if ([] === $supportingPatientInformation) {
            return $this;
        }
        foreach($supportingPatientInformation as $v) {
            if ($v instanceof FHIRReference) {
                $this->addSupportingPatientInformation($v);
            } else {
                $this->addSupportingPatientInformation(new FHIRReference($v));
            }
        }
        return $this;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * The targeted disease for the recommendation.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    public function getTargetDisease()
    {
        return $this->targetDisease;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * The targeted disease for the recommendation.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept $targetDisease
     * @return static
     */
    public function setTargetDisease(FHIRCodeableConcept $targetDisease = null)
    {
        $this->targetDisease = $targetDisease;
        return $this;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine that pertains to the recommendation.
     *
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept
     */
    public function getVaccineCode()
    {
        return $this->vaccineCode;
    }

    /**
     * A concept that may be defined by a formal reference to a terminology or ontology
     * or may be provided by text.
     * 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
     *
     * Vaccine that pertains to the recommendation.
     *
     * @param null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRCodeableConcept $vaccineCode
     * @return static
     */
    public function setVaccineCode(FHIRCodeableConcept $vaccineCode = null)
    {
        $this->vaccineCode = $vaccineCode;
        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->getDate())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_DATE] = $fieldErrs;
            }
        }
        if ([] !== ($vs = $this->getDateCriterion())) {
            foreach($vs as $i => $v) {
                if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                    $errs[sprintf('%s.%d', self::FIELD_DATE_CRITERION, $i)] = $fieldErrs;
                }
            }
        }
        if (null !== ($v = $this->getDoseNumber())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_DOSE_NUMBER] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getForecastStatus())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_FORECAST_STATUS] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getProtocol())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_PROTOCOL] = $fieldErrs;
            }
        }
        if ([] !== ($vs = $this->getSupportingImmunization())) {
            foreach($vs as $i => $v) {
                if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                    $errs[sprintf('%s.%d', self::FIELD_SUPPORTING_IMMUNIZATION, $i)] = $fieldErrs;
                }
            }
        }
        if ([] !== ($vs = $this->getSupportingPatientInformation())) {
            foreach($vs as $i => $v) {
                if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                    $errs[sprintf('%s.%d', self::FIELD_SUPPORTING_PATIENT_INFORMATION, $i)] = $fieldErrs;
                }
            }
        }
        if (null !== ($v = $this->getTargetDisease())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_TARGET_DISEASE] = $fieldErrs;
            }
        }
        if (null !== ($v = $this->getVaccineCode())) {
            if ([] !== ($fieldErrs = $v->_getValidationErrors())) {
                $errs[self::FIELD_VACCINE_CODE] = $fieldErrs;
            }
        }
        if (isset($validationRules[self::FIELD_DATE])) {
            $v = $this->getDate();
            foreach($validationRules[self::FIELD_DATE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_DATE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DATE])) {
                        $errs[self::FIELD_DATE] = [];
                    }
                    $errs[self::FIELD_DATE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_DATE_CRITERION])) {
            $v = $this->getDateCriterion();
            foreach($validationRules[self::FIELD_DATE_CRITERION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_DATE_CRITERION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DATE_CRITERION])) {
                        $errs[self::FIELD_DATE_CRITERION] = [];
                    }
                    $errs[self::FIELD_DATE_CRITERION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_DOSE_NUMBER])) {
            $v = $this->getDoseNumber();
            foreach($validationRules[self::FIELD_DOSE_NUMBER] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_DOSE_NUMBER, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_DOSE_NUMBER])) {
                        $errs[self::FIELD_DOSE_NUMBER] = [];
                    }
                    $errs[self::FIELD_DOSE_NUMBER][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_FORECAST_STATUS])) {
            $v = $this->getForecastStatus();
            foreach($validationRules[self::FIELD_FORECAST_STATUS] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_FORECAST_STATUS, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_FORECAST_STATUS])) {
                        $errs[self::FIELD_FORECAST_STATUS] = [];
                    }
                    $errs[self::FIELD_FORECAST_STATUS][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_PROTOCOL])) {
            $v = $this->getProtocol();
            foreach($validationRules[self::FIELD_PROTOCOL] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_PROTOCOL, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_PROTOCOL])) {
                        $errs[self::FIELD_PROTOCOL] = [];
                    }
                    $errs[self::FIELD_PROTOCOL][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_SUPPORTING_IMMUNIZATION])) {
            $v = $this->getSupportingImmunization();
            foreach($validationRules[self::FIELD_SUPPORTING_IMMUNIZATION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_SUPPORTING_IMMUNIZATION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_SUPPORTING_IMMUNIZATION])) {
                        $errs[self::FIELD_SUPPORTING_IMMUNIZATION] = [];
                    }
                    $errs[self::FIELD_SUPPORTING_IMMUNIZATION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_SUPPORTING_PATIENT_INFORMATION])) {
            $v = $this->getSupportingPatientInformation();
            foreach($validationRules[self::FIELD_SUPPORTING_PATIENT_INFORMATION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_SUPPORTING_PATIENT_INFORMATION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_SUPPORTING_PATIENT_INFORMATION])) {
                        $errs[self::FIELD_SUPPORTING_PATIENT_INFORMATION] = [];
                    }
                    $errs[self::FIELD_SUPPORTING_PATIENT_INFORMATION][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_TARGET_DISEASE])) {
            $v = $this->getTargetDisease();
            foreach($validationRules[self::FIELD_TARGET_DISEASE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_TARGET_DISEASE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_TARGET_DISEASE])) {
                        $errs[self::FIELD_TARGET_DISEASE] = [];
                    }
                    $errs[self::FIELD_TARGET_DISEASE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_VACCINE_CODE])) {
            $v = $this->getVaccineCode();
            foreach($validationRules[self::FIELD_VACCINE_CODE] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_IMMUNIZATION_RECOMMENDATION_DOT_RECOMMENDATION, self::FIELD_VACCINE_CODE, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_VACCINE_CODE])) {
                        $errs[self::FIELD_VACCINE_CODE] = [];
                    }
                    $errs[self::FIELD_VACCINE_CODE][$rule] = $err;
                }
            }
        }
        if (isset($validationRules[self::FIELD_MODIFIER_EXTENSION])) {
            $v = $this->getModifierExtension();
            foreach($validationRules[self::FIELD_MODIFIER_EXTENSION] as $rule => $constraint) {
                $err = $this->_performValidation(PHPFHIRConstants::TYPE_NAME_BACKBONE_ELEMENT, self::FIELD_MODIFIER_EXTENSION, $rule, $constraint, $v);
                if (null !== $err) {
                    if (!isset($errs[self::FIELD_MODIFIER_EXTENSION])) {
                        $errs[self::FIELD_MODIFIER_EXTENSION] = [];
                    }
                    $errs[self::FIELD_MODIFIER_EXTENSION][$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\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationRecommendation $type
     * @param null|int $libxmlOpts
     * @return null|\DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationRecommendation
     */
    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('FHIRImmunizationRecommendationRecommendation::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('FHIRImmunizationRecommendationRecommendation::xmlUnserialize - $sxe value must be null, \\SimpleXMLElement, or valid XML string, %s seen', gettype($sxe)));
        }
        if (null === $type) {
            $type = new FHIRImmunizationRecommendationRecommendation;
        } elseif (!is_object($type) || !($type instanceof FHIRImmunizationRecommendationRecommendation)) {
            throw new \RuntimeException(sprintf(
                'FHIRImmunizationRecommendationRecommendation::xmlUnserialize - $type must be instance of \DCarbone\PHPFHIRGenerated\STU3\FHIRElement\FHIRBackboneElement\FHIRImmunizationRecommendation\FHIRImmunizationRecommendationRecommendation or null, %s seen.',
                is_object($type) ? get_class($type) : gettype($type)
            ));
        }
        FHIRBackboneElement::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->date)) {
            $type->setDate(FHIRDateTime::xmlUnserialize($children->date));
        }
        if (isset($attributes->date)) {
            $pt = $type->getDate();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->date);
            } else {
                $type->setDate((string)$attributes->date);
            }
        }
        if (isset($children->dateCriterion)) {
            foreach($children->dateCriterion as $child) {
                $type->addDateCriterion(FHIRImmunizationRecommendationDateCriterion::xmlUnserialize($child));
            }
        }
        if (isset($children->doseNumber)) {
            $type->setDoseNumber(FHIRPositiveInt::xmlUnserialize($children->doseNumber));
        }
        if (isset($attributes->doseNumber)) {
            $pt = $type->getDoseNumber();
            if (null !== $pt) {
                $pt->setValue((string)$attributes->doseNumber);
            } else {
                $type->setDoseNumber((string)$attributes->doseNumber);
            }
        }
        if (isset($children->forecastStatus)) {
            $type->setForecastStatus(FHIRCodeableConcept::xmlUnserialize($children->forecastStatus));
        }
        if (isset($children->protocol)) {
            $type->setProtocol(FHIRImmunizationRecommendationProtocol::xmlUnserialize($children->protocol));
        }
        if (isset($children->supportingImmunization)) {
            foreach($children->supportingImmunization as $child) {
                $type->addSupportingImmunization(FHIRReference::xmlUnserialize($child));
            }
        }
        if (isset($children->supportingPatientInformation)) {
            foreach($children->supportingPatientInformation as $child) {
                $type->addSupportingPatientInformation(FHIRReference::xmlUnserialize($child));
            }
        }
        if (isset($children->targetDisease)) {
            $type->setTargetDisease(FHIRCodeableConcept::xmlUnserialize($children->targetDisease));
        }
        if (isset($children->vaccineCode)) {
            $type->setVaccineCode(FHIRCodeableConcept::xmlUnserialize($children->vaccineCode));
        }
        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->getDate())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_DATE, null, $v->_getFHIRXMLNamespace()));
        }
        if ([] !== ($vs = $this->getDateCriterion())) {
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $v->xmlSerialize($sxe->addChild(self::FIELD_DATE_CRITERION, null, $v->_getFHIRXMLNamespace()));
            }
        }
        if (null !== ($v = $this->getDoseNumber())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_DOSE_NUMBER, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getForecastStatus())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_FORECAST_STATUS, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getProtocol())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_PROTOCOL, null, $v->_getFHIRXMLNamespace()));
        }
        if ([] !== ($vs = $this->getSupportingImmunization())) {
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $v->xmlSerialize($sxe->addChild(self::FIELD_SUPPORTING_IMMUNIZATION, null, $v->_getFHIRXMLNamespace()));
            }
        }
        if ([] !== ($vs = $this->getSupportingPatientInformation())) {
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $v->xmlSerialize($sxe->addChild(self::FIELD_SUPPORTING_PATIENT_INFORMATION, null, $v->_getFHIRXMLNamespace()));
            }
        }
        if (null !== ($v = $this->getTargetDisease())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_TARGET_DISEASE, null, $v->_getFHIRXMLNamespace()));
        }
        if (null !== ($v = $this->getVaccineCode())) {
            $v->xmlSerialize($sxe->addChild(self::FIELD_VACCINE_CODE, null, $v->_getFHIRXMLNamespace()));
        }
        return $sxe;
    }

    /**
     * @return array
     */
    public function jsonSerialize()
    {
        $a = parent::jsonSerialize();
        if (null !== ($v = $this->getDate())) {
            $a[self::FIELD_DATE] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRDateTime::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRDateTime::FIELD_VALUE]);
                $a[self::FIELD_DATE_EXT] = $enc;
            }
        }
        if ([] !== ($vs = $this->getDateCriterion())) {
            $a[self::FIELD_DATE_CRITERION] = [];
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $a[self::FIELD_DATE_CRITERION][] = $v;
            }
        }
        if (null !== ($v = $this->getDoseNumber())) {
            $a[self::FIELD_DOSE_NUMBER] = $v->getValue();
            $enc = $v->jsonSerialize();
            $cnt = count($enc);
            if (0 < $cnt && (1 !== $cnt || (1 === $cnt && !array_key_exists(FHIRPositiveInt::FIELD_VALUE, $enc)))) {
                unset($enc[FHIRPositiveInt::FIELD_VALUE]);
                $a[self::FIELD_DOSE_NUMBER_EXT] = $enc;
            }
        }
        if (null !== ($v = $this->getForecastStatus())) {
            $a[self::FIELD_FORECAST_STATUS] = $v;
        }
        if (null !== ($v = $this->getProtocol())) {
            $a[self::FIELD_PROTOCOL] = $v;
        }
        if ([] !== ($vs = $this->getSupportingImmunization())) {
            $a[self::FIELD_SUPPORTING_IMMUNIZATION] = [];
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $a[self::FIELD_SUPPORTING_IMMUNIZATION][] = $v;
            }
        }
        if ([] !== ($vs = $this->getSupportingPatientInformation())) {
            $a[self::FIELD_SUPPORTING_PATIENT_INFORMATION] = [];
            foreach($vs as $v) {
                if (null === $v) {
                    continue;
                }
                $a[self::FIELD_SUPPORTING_PATIENT_INFORMATION][] = $v;
            }
        }
        if (null !== ($v = $this->getTargetDisease())) {
            $a[self::FIELD_TARGET_DISEASE] = $v;
        }
        if (null !== ($v = $this->getVaccineCode())) {
            $a[self::FIELD_VACCINE_CODE] = $v;
        }
        if ([] !== ($vs = $this->_getFHIRComments())) {
            $a[PHPFHIRConstants::JSON_FIELD_FHIR_COMMENTS] = $vs;
        }
        return $a;
    }

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


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>doctator - Improve your docs</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="doctator">

    <link href="/css/bootstrap.css" rel="stylesheet">
    <link href="/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="/css/app.css" rel="stylesheet">

    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/img/ico/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/ico/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="/img/ico/apple-touch-icon-57-precomposed.png">

Improve your docs

Enable your users to comment and improve your documentation.

Add doctator to your project »

Open Source

We love open source, so doctator is open sourced. The hosted version
		  is freely available to open source projects.

Social Comments

Great annotations or examples deserve attention. With powerful voting features, your users
		  will never miss the best doctations.

Great Examples

Users can provide great examples to your API and doctator gives you the tools
		  with Markdown and built-in syntax highlighting for 52 languages.

© doctator.org 2012

redpajama_set_name: RedPajamaGithub


text:
'use strict';

app.controller('MainPageController',
    function MainPageController($scope, $rootScope, author, copyright, identity) {
        $scope.author = author;
        $scope.copyright = copyright;

        if (identity.isAuthenticated()) {
            $rootScope.isLoggedIn = true;
            $rootScope.username = identity.getCurrentUser().userName;
        }
    }
);


text:
* Implemented wrappers around sprites and textures
* Implemented a texture atlas, and based the sprite wrapper around this
    * `defsub/getsub` allow easy access to "subtextures"
    * `key-texture` allows one to easily change a sprite's texture by specifying a key for the subtexture desired
* Decided no use implementing parallax if I have 3D, and verified the effect looks good with perspective camera
* Began adapting the ThreeJS backend to handle creating backend specific render components
    * No more annoying "add-to-backend" calls
* Made `:render` into `:renders` to allow multiple render targets for an entity
    * Updated Cameras to this new system

# Problems to solve

Async texture loading! Ugh!

ThreeJS returns the object immediately, which allows me to store it, but I'm already hitting "can't call on undefined" errors from the object not being populated yet. I need someway to promise this, or not need it's width until much later

I can defer setting the scale until the `prepare-scene`, but that would be more expensive (doing it everyframe, versus when scale changes).

## tiling

Aside from implementing a custom shader, I haven't found a way to do this w/o making a ton of sprites, which reports suggest is horribly slow and memory hog.

...maybe I can offscreen render a new texture and map that to a single large sprite?


text:
module.exports.loop = function() {
  return console.log("CPU Limit: " + Game.cpuLimit + " | Counter: " + Game.time + " | Used: " + (Game.getUsedCpu()));
};


text:
describe('Timepicker feature', function() {
  'use strict';

  var $input1,
    $input2,
    $input3,
    $input4,
    $input5,
    $timepicker1,
    $timepicker2,
    $timepicker3,
    $timepicker4,
    $timepicker5,
    tp1,
    tp2,
    tp3,
    tp4,
    tp5;

  beforeEach(function () {
    loadFixtures('timepicker.html');

    $input1 = $('#timepicker1');
    $timepicker1 = $input1.timepicker();
    tp1 = $timepicker1.data('timepicker');

    $input2 = $('#timepicker2');
    $timepicker2 = $input2.timepicker({
      template: 'modal',
      showSeconds: true,
      minuteStep: 30,
      secondStep: 30,
      defaultTime: false
    });
    tp2 = $timepicker2.data('timepicker');

    $input3 = $('#timepicker3');
    $timepicker3 = $input3.timepicker({
      showMeridian: false,
      showSeconds: true,
      defaultTime: '13:25:15',
      maxHours: 100
    });
    tp3 = $timepicker3.data('timepicker');

    $input4 = $('#timepicker-z-index');
    $timepicker4 = $input4.timepicker();
    tp4 = $timepicker4.data('timepicker');

    $input5 = $('#timepicker-snapper');
    $timepicker5 = $input5.timepicker({
      snapToStep: true,
      minuteStep: 30,
      defaultTime: '12:00 AM'
    });
    tp5 = $timepicker5.data('timepicker');
  });

  afterEach(function () {
    if ($input1.data('timepicker') !== undefined) {
      $input1.data('timepicker').remove();
    }
    if ($input2.data('timepicker') !== undefined) {
      $input2.data('timepicker').remove();
    }
    if ($input3.data('timepicker') !== undefined) {
      $input3.data('timepicker').remove();
    }
    if ($input4.data('timepicker') !== undefined) {
      $input4.data('timepicker').remove();
    }
    if ($input5.data('timepicker') !== undefined) {
      $input5.data('timepicker').remove();
    }
    $input1.remove();
    $input2.remove();
    $input3.remove();
    $input4.remove();
    $input5.remove();
  });

  it('should be available on the jquery object', function() {
    expect($.fn.timepicker).toBeDefined();
  });

  it('should be chainable', function() {
    expect($timepicker1).toBe($input1);
  });

  it('should have sensible defaults', function() {
    expect(tp1.defaultTime).toBeTruthy();
    expect(tp1.minuteStep).toBe(15);
    expect(tp1.secondStep).toBe(15);
    expect(tp1.snapToStep).toBe(false);
    expect(tp1.disableFocus).toBe(false);
    expect(tp1.showSeconds).toBe(false);
    expect(tp1.showInputs).toBe(true);
    expect(tp1.showMeridian).toBe(true);
    expect(tp1.template).toBe('dropdown');
    expect(tp1.appendWidgetTo).toBe('body');
    expect(tp1.modalBackdrop).toBe(false);
    expect(tp1.modalBackdrop).toBe(false);
    expect(tp1.isOpen).toBe(false);
    expect(tp1.showWidgetOnAddonClick).toBe(true);
    expect(tp1.maxHours).toBe(24);
  });

  it('should allow user to configure defaults', function() {
    expect(tp2.template).toBe('modal');
    expect(tp2.minuteStep).toBe(30);
  });

  it('should be configurable with data attributes', function() {
    $('body').append('
<input id="customTimepicker" data-template="modal" data-minute-step="30" data-modal-backdrop="true" data-show-meridian="true" type="text"/></div');

    var $customInput = $('body').find('#customTimepicker'),
        tpCustom = $customInput.timepicker().data('timepicker');

    expect($('body').find('#customTimepicker').length).toBe(1);
    expect(tpCustom.template).toBe('modal');
    expect(tpCustom.minuteStep).toBe(30, 'data-minute-step not working');
    expect(tpCustom.modalBackdrop).toBe(true, 'data-modal-backdrop not working');
    expect(tpCustom.showMeridian).toBe(true, 'data-show-meridian not working');

    tpCustom.remove();
  });

  it('should be initialized on click with data-provide attribute', function() {
    $('body').append('
<input id="fooTimepicker" data-provide="timepicker" type="text" />
');
    $('#fooTimepicker').trigger('click');

    expect($('#fooTimepicker').data('timepicker')).toBeDefined();
  });

  it('should be initialized on focus with data-provide attribute', function() {
    $('body').append('
<input id="barTimepicker" data-provide="timepicker" type="text" />
');
    $('#barTimepicker').trigger('focus');

    expect($('#barTimepicker').data('timepicker')).toBeDefined();
  });

  it('should have current time by default', function() {
    var dTime = new Date(),
      hour = dTime.getHours(),
      minutes = dTime.getMinutes(),
      meridian;

    if (minutes !== 0) {
      minutes = Math.ceil(minutes / tp1.minuteStep) * tp1.minuteStep;
    }

    if (minutes === 60) {
      hour += 1;
      minutes = 0;
    }

    if (hour < 12) {
      meridian = 'AM';
    } else {
      meridian = 'PM';
    }

    if (hour > 12) {
      hour = hour - 12;
    }
    if (hour === 0) {
      hour = 12;
    }

    expect(tp1.hour).toBe(hour);
    expect(tp1.minute).toBe(minutes);
    expect(tp1.meridian).toBe(meridian);
  });

  it('should not override time with current time if value is already set', function() {
    $('body').append('
<input id="timepickerCustomInput" type="text" value="12:15 AM" />
');
    var $customInput = $('#timepickerCustomInput').timepicker(),
      tpCustom = $customInput.data('timepicker');

    expect($customInput.val()).toBe('12:15 AM');

    tpCustom.remove();
    $('#timepickerCustom').remove();
  });

  it('should have no value if defaultTime is set to false', function() {
    expect($input2.val()).toBe('');
  });

  it('should be able to set default time with config option', function() {
    expect(tp3.getTime()).toBe('13:25:15');
  });

  it('should update the element and widget with the setTime method', function() {
    tp2.setTime('9:15:20 AM');

    expect(tp2.hour).toBe(9);
    expect(tp2.minute).toBe(15);
    expect(tp2.second).toBe(20);
    expect(tp2.meridian).toBe('AM');
    expect($input2.val()).toBe('9:15:20 AM');
    expect(tp2.$widget.find('.bootstrap-timepicker-hour').val()).toBe('9');
    expect(tp2.$widget.find('.bootstrap-timepicker-minute').val()).toBe('15');
    expect(tp2.$widget.find('.bootstrap-timepicker-second').val()).toBe('20');
    expect(tp2.$widget.find('.bootstrap-timepicker-meridian').val()).toBe('AM');
  });

  it('should be able get & set the pickers time', function() {
    tp1.setTime('11:15 PM');
    expect(tp1.getTime()).toBe('11:15 PM');
    tp3.setTime('23:15:20');
    expect(tp3.getTime()).toBe('23:15:20');
    tp3.setTime('60:00:00');
    expect(tp3.getTime()).toBe('60:00:00');

    tp1.setTime('11pm');
    expect(tp1.getTime()).toBe('11:00 PM');
    tp3.setTime('11pm');
    expect(tp3.getTime()).toBe('23:00:00');

    tp1.setTime('11a');
    expect(tp1.getTime()).toBe('11:00 AM');
    tp3.setTime('11a');
    expect(tp3.getTime()).toBe('11:00:00');

    tp1.setTime('1');
    expect(tp1.getTime()).toBe('1:00 AM');
    tp3.setTime('1');
    expect(tp3.getTime()).toBe('1:00:00');

    tp1.setTime('13');
    expect(tp1.getTime()).toBe('1:00 PM');
    tp3.setTime('13');
    expect(tp3.getTime()).toBe('13:00:00');

    tp1.setTime('10:20p');
    expect(tp1.getTime()).toBe('10:20 PM');
    tp3.setTime('10:20p');
    expect(tp3.getTime()).toBe('22:20:00');

    tp1.setTime('10:20 p.m.');
    expect(tp1.getTime()).toBe('10:20 PM');
    tp3.setTime('10:20 p.m.');
    expect(tp3.getTime()).toBe('22:20:00');

    tp1.setTime('10:20a');
    expect(tp1.getTime()).toBe('10:20 AM');
    tp3.setTime('10:20a');
    expect(tp3.getTime()).toBe('10:20:00');

    tp1.setTime('10:2010');
    expect(tp1.getTime()).toBe('10:20 AM', 'setTime with 10:2010 on tp1');
    tp3.setTime('10:2010');
    expect(tp3.getTime()).toBe('10:20:10', 'setTime with 10:2010 on tp3');

    tp1.setTime('102010');
    expect(tp1.getTime()).toBe('10:20 AM', 'setTime with 102010 on tp1');
    tp3.setTime('102010');
    expect(tp3.getTime()).toBe('10:20:10', 'setTime with 102010 on tp3');

    tp1.setTime('2320');
    expect(tp1.getTime()).toBe('11:20 PM', 'setTime with 2320 on tp1');
    tp3.setTime('2320');
    expect(tp3.getTime()).toBe('23:20:00', 'setTime with 2320 on tp3');

    tp3.setTime('0:00');
    expect(tp3.getTime()).toBe('0:00:00', 'setTime with 0:00 on tp3');

    tp3.setTime('12:00 AM');
    expect(tp3.getTime()).toBe('0:00:00', 'setTime with 0:00 on tp3');
  });

  it('should update picker on blur', function() {
    $input1.val('10:25 AM');
    expect(tp1.getTime()).not.toBe('10:25 AM');
    $input1.trigger('blur');
    expect(tp1.getTime()).toBe('10:25 AM');
  });

  it('should update element with updateElement method', function() {
    tp1.hour = 10;
    tp1.minute = 30;
    tp1.meridian = 'PM';
    tp1.updateElement();
    expect($input1.val()).toBe('10:30 PM');
  });

  it('should update widget with updateWidget method', function() {
    tp2.hour = 10;
    tp2.minute = 30;
    tp2.second = 15;

    expect(tp2.$widget.find('.bootstrap-timepicker-hour').val()).not.toBe('10');
    expect(tp2.$widget.find('.bootstrap-timepicker-minute').val()).not.toBe('30');
    expect(tp2.$widget.find('.bootstrap-timepicker-second').val()).not.toBe('15');

    tp2.updateWidget();

    expect(tp2.$widget.find('.bootstrap-timepicker-hour').val()).toBe('10');
    expect(tp2.$widget.find('.bootstrap-timepicker-minute').val()).toBe('30');
    expect(tp2.$widget.find('.bootstrap-timepicker-second').val()).toBe('15');
  });

  it('should update picker with updateFromElementVal method', function() {
    tp1.hour = 12;
    tp1.minute = 12;
    tp1.meridian = 'PM';
    tp1.update();

    $input1.val('10:30 AM');

    expect(tp1.$widget.find('.bootstrap-timepicker-hour').val()).not.toBe('10');
    expect(tp1.$widget.find('.bootstrap-timepicker-minute').val()).not.toBe('30');
    expect(tp1.$widget.find('.bootstrap-timepicker-meridian').val()).not.toBe('AM');
    expect(tp1.hour).not.toBe(10);
    expect(tp1.minute).not.toBe(30);
    expect(tp1.meridian).not.toBe('AM');

    tp1.updateFromElementVal();

    expect(tp1.$widget.find('.bootstrap-timepicker-hour').val()).toBe('10');
    expect(tp1.$widget.find('.bootstrap-timepicker-minute').val()).toBe('30');
    expect(tp1.$widget.find('.bootstrap-timepicker-meridian').val()).toBe('AM');
    expect(tp1.hour).toBe(10);
    expect(tp1.minute).toBe(30);
    expect(tp1.meridian).toBe('AM');
  });

  it('should update picker with updateFromWidgetInputs method', function() {
    tp1.hour = 12;
    tp1.minute = 12;
    tp1.meridian = 'PM';
    tp1.update();

    tp1.$widget.find('.bootstrap-timepicker-hour').val(10);
    tp1.$widget.find('.bootstrap-timepicker-minute').val(30);
    tp1.$widget.find('.bootstrap-timepicker-meridian').val('AM');

    expect(tp1.hour).not.toBe(10);
    expect(tp1.minute).not.toBe(30);
    expect(tp1.meridian).not.toBe('AM');
    expect($input1.val()).not.toBe('10:30 AM');

    tp1.updateFromWidgetInputs();

    expect(tp1.hour).toBe(10);
    expect(tp1.minute).toBe(30);
    expect(tp1.meridian).toBe('AM');
    expect($input1.val()).toBe('10:30 AM');
  });

  it('should increment hours with incrementHour method', function() {
    tp1.hour = 9;
    tp1.incrementHour();
    expect(tp1.hour).toBe(10);
  });

  it('should decrement hours with decrementHour method', function() {
    tp1.hour = 9;
    tp1.decrementHour();
    expect(tp1.hour).toBe(8);
  });

  it('should toggle meridian if hour goes past 12', function() {
    $input1.val('11:00 AM');
    tp1.updateFromElementVal();
    tp1.incrementHour();

    expect(tp1.hour).toBe(12);
    expect(tp1.minute).toBe(0);
    expect(tp1.meridian).toBe('PM');
  });

  it('should toggle meridian if hour goes below 1', function() {
    $input1.val('11:00 AM');
    tp1.updateFromElementVal();
    tp1.incrementHour();

    expect(tp1.hour).toBe(12);
    expect(tp1.minute).toBe(0);
    expect(tp1.meridian).toBe('PM');
  });

  it('should set hour to 1 if hour increments on 12 for 12h clock', function() {
    $input1.val('11:15 PM');
    tp1.updateFromElementVal();
    tp1.incrementHour();
    tp1.incrementHour();

    expect(tp1.getTime()).toBe('1:15 AM');
  });

  it('should set hour to 0 if hour increments on "maxHours-1" for 24h clock', function() {
    $input3.val('98:15:30');
    tp3.updateFromElementVal();
    tp3.incrementHour();
    tp3.incrementHour();

    expect(tp3.hour).toBe(0);
    expect(tp3.minute).toBe(15);
    expect(tp3.second).toBe(30);
  });

  it('should increment minutes with incrementMinute method', function() {
    tp1.minute = 10;
    tp1.incrementMinute();

    expect(tp1.minute).toBe(15);

    tp2.minute = 0;
    tp2.incrementMinute();

    expect(tp2.minute).toBe(30);
  });

  it('should decrement minutes with decrementMinute method', function() {
    tp1.hour = 11;
    tp1.minute = 0;
    tp1.decrementMinute();

    expect(tp1.hour).toBe(10);
    expect(tp1.minute).toBe(45);

    tp2.hour = 11;
    tp2.minute = 0;
    tp2.decrementMinute();

    expect(tp2.hour).toBe(10);
    expect(tp2.minute).toBe(30);
  });

  it('should increment hour if minutes increment past 59', function() {
    $input1.val('11:55 AM');
    tp1.updateFromElementVal();
    tp1.incrementMinute();
    tp1.update();

    expect(tp1.getTime()).toBe('12:00 PM');
  });

  it('should toggle meridian with toggleMeridian method', function() {
    tp1.meridian = 'PM';
    tp1.toggleMeridian();

    expect(tp1.meridian).toBe('AM');
  });

  it('should increment seconds with incrementSecond method', function() {
    tp1.second = 0;
    tp1.incrementSecond();

    expect(tp1.second).toBe(15);

    tp2.second = 0;
    tp2.incrementSecond();

    expect(tp2.second).toBe(30);
  });

  it('should decrement seconds with decrementSecond method', function() {
    tp2.hour = 11;
    tp2.minute = 0;
    tp2.second = 0;
    tp2.decrementSecond();

    expect(tp2.minute).toBe(59);
    expect(tp2.second).toBe(30);
  });

  it('should increment minute by 1 if seconds increment past 59', function() {
    $input2.val('11:55:30 AM');
    tp2.updateFromElementVal();
    tp2.incrementSecond();
    tp2.update();

    expect(tp2.getTime()).toBe('11:56:00 AM');
  });

  it('should not have any remaining events if remove is called', function() {
    var hideEvents = 0;

    $input1.on('hide.timepicker', function() {
      hideEvents++;
    });

    $input1.parents('div').find('.input-group-addon').trigger('click');
    $('body').trigger('mousedown');

    expect(hideEvents).toBe(1);

    tp1.remove();
    tp2.remove();
    tp3.remove();
    tp4.remove();

    $('body').trigger('click');
    expect(hideEvents).toBe(1);
  });

  it('should be able to reset time by using setTime 0/null', function() {
    tp1.hour = 10;
    tp1.minute = 30;
    tp1.meridian = 'PM';
    tp1.updateElement();

    $input1.timepicker('setTime', null);
    expect(tp1.getTime()).toBe('');
  });

  it('should snap minutes to multiple of step when using setTime', function() {
    tp5.setTime('2:33 AM');
    expect(tp5.getTime()).toBe('2:30 AM');
  });

  it('should place timepicker on top of parents', function() {
    tp4.showWidget();
    $('body').find('.bootstrap-timepicker-widget').css('position', 'relative');
    expect($('body').find('.bootstrap-timepicker-widget').css('z-index')).toBe('1010');
  });

  it('should not have the widget in the DOM if remove method is called', function() {
    tp1.showWidget();
    tp2.showWidget();
    tp3.showWidget();
    tp4.showWidget();
    expect($('body')).toContain('.bootstrap-timepicker-widget');
    tp1.remove();
    tp2.remove();
    tp3.remove();
    tp4.remove();
    expect($('body')).not.toContain('.bootstrap-timepicker-widget');
  });

  it('should be able to set time from a script', function() {
    $input1.timepicker('setTime', '12:35 PM');
    tp1.update();
    expect(tp1.getTime()).toBe('12:35 PM');
  });

  it('should be able to opened from script', function() {
    expect(tp1.isOpen).toBe(false);
    $input1.timepicker('showWidget');
    expect(tp1.isOpen).toBe(true);
  });

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.kisoonlineapp</groupId>
    <artifactId>kisoonlineapp-parent</artifactId>
    <version>1.6.3_2019</version>
    <packaging>pom</packaging>

    <modules>
        <module>kisoonlineapp-gui</module>
        <module>kisoonlineapp-itest</module>
        <module>kisoonlineapp-csv</module>
        <module>kisoonlineapp-jmeter</module>

        <module>kisoonlineapp-goaccess</module>
        <module>kisoonlineapp-dist</module>
        <module>apacheconfig</module>
    </modules>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-7.0</artifactId>
                <version>1.0.3.Final</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.omnifaces</groupId>
                <artifactId>omnifaces</artifactId>
                <version>2.1</version>
            </dependency>
            <dependency>
                <groupId>org.mnode.ical4j</groupId>
                <artifactId>ical4j</artifactId>
                <version>1.0.6</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.1.10.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.12</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>1.3</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>1.10.17</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

</project>


text:
<resources>

    <!--
        Base application theme for API 11+. This theme completely replaces
        AppBaseTheme from res/values/styles.xml on API 11+ devices.
    -->

    <style name="CustomActionBarTheme"
           parent="android:Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="android:Widget.Holo.Light.ActionBar.Solid.Inverse">
        <item name="android:background">#CC0000</item>
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="CustomActionBarTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

</resources>


text:
package com.wiley.driver.factory.capabilities;

import org.openqa.selenium.remote.DesiredCapabilities;

/**
 * Caps for Safari on IOS
 */
public class IosSafariCaps extends TeasyCaps {

    public IosSafariCaps(DesiredCapabilities customCaps) {
        super(customCaps);
    }

    @Override
    public DesiredCapabilities get() {
        DesiredCapabilities caps = getIOSSafariCaps();
        if (!this.customCaps.asMap().isEmpty()) {
            caps.merge(this.customCaps);
        }
        return caps;
    }

    private DesiredCapabilities getIOSSafariCaps() {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("app", "Safari");
        caps.setCapability("platformName", "iOS");
        caps.setCapability("newCommandTimeout", "900");
        setLoggingPrefs(caps);
        return caps;
    }
}


text:
module Compose

using Color
using Iterators
using DataStructures
using Compat
import JSON

import Base: length, start, next, done, isempty, getindex, setindex!,
             display, writemime, convert, zero, isless, max, fill, size, copy,
             min, max, abs, +, -, *, /

export compose, compose!, Context, UnitBox, AbsoluteBoundingBox, Rotation, Mirror,
       ParentDrawContext, context, ctxpromise, table, set_units!, minwidth, minheight,
       text_extents, max_text_extents, polygon, line, rectangle, circle, path,
       ellipse, text, curve, bitmap, stroke, fill, strokedash, strokelinecap,
       strokelinejoin, linewidth, visible, fillopacity, strokeopacity, clip,
       font, fontsize, svgid, svgclass, svgattribute, jsinclude, jscall, Measure,
       inch, mm, cm, pt, px, cx, cy, w, h, hleft, hcenter, hright, vtop, vcenter,
       vbottom, SVG, SVGJS, PGF, PNG, PS, PDF, draw, pad, pad_inner, pad_outer,
       hstack, vstack, gridstack, LineCapButt, LineCapSquare, LineCapRound,
       CAIROSURFACE, introspect, set_default_graphic_size, set_default_jsmode,
       boundingbox, Patchable

abstract Backend

function isinstalled(pkg, ge=v"0.0.0")
    try
        # Pkg.installed might throw an error,
        # we need to account for it to be able to precompile
        ver = Pkg.installed(pkg)
        ver == nothing && try
            # Assume the version is new enough if the package is in LOAD_PATH
            require(pkg)
            return true
        catch
            return false
        end
        return ver >= ge
    catch
        return false
    end
end

include("misc.jl")
include("measure.jl")
include("list.jl")

# Every graphic in Compose consists of a tree.
abstract ComposeNode

# Used to mark null child pointers
immutable NullNode <: ComposeNode end
nullnode = NullNode()

include("form.jl")
include("property.jl")
include("container.jl")
include("table.jl")
include("stack.jl")

# How large to draw graphics when not explicitly drawing to a backend
default_graphic_width = sqrt(2)*10*cm
default_graphic_height = 10cm

function set_default_graphic_size(width::MeasureOrNumber,
                                  height::MeasureOrNumber)
    global default_graphic_width
    global default_graphic_height
    default_graphic_width = x_measure(width)
    default_graphic_height = y_measure(height)
    nothing
end

default_graphic_format = :html

function set_default_graphic_format(fmt::Symbol)
    if !(fmt in [:html, :png, :svg, :pdf, :ps, :pgf])
        error("$(fmt) is not a supported plot format")
    end
    global default_graphic_format
    default_graphic_format = fmt
    nothing
end

# Default means to include javascript dependencies in the SVGJS backend.
default_jsmode = :embed

function set_default_jsmode(mode::Symbol)
    global default_jsmode
    if mode in [:none, :exclude, :embed, :linkabs, :linkrel]
        default_jsmode = mode
    else
        error("$(mode) is not a valid jsmode")
    end
    nothing
end

function default_mime()
    if default_graphic_format == :png
        "image/png"
    elseif default_graphic_format == :svg
        "image/svg+xml"
    elseif default_graphic_format == :html
        "text/html"
    elseif default_graphic_format == :ps
        "application/postscript"
    elseif default_graphic_format == :pdf
        "application/pdf"
    elseif default_graphic_format == :pgf
        "application/x-tex"
    else
        ""
    end
end

# Default property values
default_font_family = "Helvetica Neue,Helvetica,Arial,sans"
default_font_size = 11pt
default_line_width = 0.3mm
default_stroke_color = nothing
default_fill_color = color("black")

# Use cairo for the PNG, PS, PDF if it's installed.
if isinstalled("Cairo")
    include("cairo_backends.jl")
else
    global PNG
    global PS
    global PDF
    PNG(args...) = error("Cairo must be installed to use the PNG backend.")
    PS(args...) = error("Cairo must be installed to use the PS backend.")
    PDF(args...) = error("Cairo must be installed to use the PDF backend.")
end
include("svg.jl")
include("pgf_backend.jl")

if isinstalled("Patchwork", v"0.1.2")
    include("patchable.jl")
end

# If available, pango and fontconfig are used to compute text extents and match
# fonts. Otherwise a simplistic pure-julia fallback is used.

if isinstalled("Fontconfig")
    pango_cairo_ctx = C_NULL
    include("pango.jl")

    function __init__()
        global pango_cairo_ctx
        global pangolayout
        ccall((:g_type_init, Cairo._jl_libgobject), Void, ())
        pango_cairo_fm  = ccall((:pango_cairo_font_map_new, libpangocairo),
                                 Ptr{Void}, ())
        pango_cairo_ctx = ccall((:pango_font_map_create_context, libpango),
                                 Ptr{Void}, (Ptr{Void},), pango_cairo_fm)
        pangolayout = PangoLayout()
    end
else
    include("fontfallback.jl")
end

function writemime(io::IO, m::MIME"text/html", ctx::Context)
    draw(SVGJS(io, default_graphic_width, default_graphic_height, false,
               jsmode=default_jsmode), ctx)
end

function writemime(io::IO, m::MIME"image/svg+xml", ctx::Context)
    draw(SVG(io, default_graphic_width, default_graphic_height, false), ctx)
end

try
    getfield(Compose, :Cairo) # throws if Cairo isn't being used
    function writemime(io::IO, ::MIME"image/png", ctx::Context)
        draw(PNG(io, default_graphic_width, default_graphic_height), ctx)
    end
end

import Base.Multimedia: @try_display, xdisplayable

function display(p::Context)
    displays = Base.Multimedia.displays
    for i = length(displays):-1:1
        m = default_mime()
        if xdisplayable(displays[i], m, p)
             @try_display return display(displays[i], m, p)
        end

        if xdisplayable(displays[i], p)
            @try_display return display(displays[i], p)
        end
    end
    invoke(display,(Any,),p)
end

function pad_outer(c::Context,
                   left_padding::MeasureOrNumber,
                   right_padding::MeasureOrNumber,
                   top_padding::MeasureOrNumber,
                   bottom_padding::MeasureOrNumber)

    left_padding   = size_measure(left_padding)
    right_padding  = size_measure(right_padding)
    top_padding    = size_measure(top_padding)
    bottom_padding = size_measure(bottom_padding)

    root = context(c.box.x0, c.box.y0,
                   c.box.width + left_padding + right_padding,
                   c.box.height + top_padding + bottom_padding,
                   minwidth=c.minwidth,
                   minheight=c.minheight)
    c = copy(c)
    c.box = BoundingBox(left_padding, top_padding,
                        1w - left_padding - right_padding,
                        1h - top_padding - bottom_padding)
    return compose!(root, c)
end

function pad_outer(c::Context, padding::MeasureOrNumber)
    return pad_outer(c, padding, padding, padding, padding)
end

function pad_outer(cs::Vector{Context},
                   left_padding::MeasureOrNumber,
                   right_padding::MeasureOrNumber,
                   top_padding::MeasureOrNumber,
                   bottom_padding::MeasureOrNumber)
    return map(c -> pad_outer(c, left_padding, right_padding,
                              top_padding, bottom_padding), cs)
end

function pad_outer(cs::Vector{Context}, padding::MeasureOrNumber)
    return pad_outer(cs, padding, padding, padding, padding)
end

function pad_inner(c::Context,
                   left_padding::MeasureOrNumber,
                   right_padding::MeasureOrNumber,
                   top_padding::MeasureOrNumber,
                   bottom_padding::MeasureOrNumber)
    left_padding   = size_measure(left_padding)
    right_padding  = size_measure(right_padding)
    top_padding    = size_measure(top_padding)
    bottom_padding = size_measure(bottom_padding)

    root = context(c.box.x0, c.box.y0,
                   c.box.width,
                   c.box.height,
                   minwidth=c.minwidth,
                   minheight=c.minheight)
    c = copy(c)
    c.box = BoundingBox(left_padding, top_padding,
                        1w - left_padding - right_padding,
                        1h - top_padding - bottom_padding)
    return compose!(root, c)
end

function pad_inner(c::Context, padding::MeasureOrNumber)
    return pad_inner(c, padding, padding, padding, padding)
end

function pad_inner(cs::Vector{Context}, left_padding::MeasureOrNumber,
                   right_padding::MeasureOrNumber,
                   top_padding::MeasureOrNumber,
                   bottom_padding::MeasureOrNumber)
    return map(c -> pad_inner(c, left_padding, right_padding,
                              top_padding, bottom_padding), cs)
end

function pad_inner(cs::Vector{Context}, padding::MeasureOrNumber)
    return pad_inner(cs, padding, padding, padding, padding)
end

function gridstack(cs::Matrix{Context})
    m, n = size(cs)
    t = Table(m, n, 1:m, 1:n, x_prop=ones(n), y_prop=ones(m))
    for i in 1:m, j in 1:n
        t[i, j] = [cs[i, j]]
    end
    return compose!(context(), t)
end

const pad = pad_outer

end # module Compose


text:
@interface PELoginViewController ()

@property (weak, nonatomic) IBOutlet UITextField *emailTextField;
@property (weak, nonatomic) IBOutlet UITextField *passwordTextField;

@end

@implementation PELoginViewController

- (IBAction)login {
  // Normally you would perform some kind of validation here, but we will skip it for this sample app.
  NSString *email = self.emailTextField.text;
  NSString *password = self.passwordTextField.text;

  [SVProgressHUD showWithStatus:@"Signing in..."];

  // This will authenticate the user agains the Podio API and maintain a session token
  [[PodioKit authenticateAsUserWithEmail:email password:password] onSuccess:^(id result) {
    [SVProgressHUD dismiss];
    NSLog(@"Successfully authenticated");
  } onError:^(NSError *error) {
    [SVProgressHUD dismiss];
    NSLog(@"Error: %@", [error localizedDescription]);
  }];
}

@end


text:
using System;

namespace WellFormedNames.Exceptions
{
	public class BadSubstitutionException : Exception
	{
		public BadSubstitutionException(string msg) : base(msg) { }

		public BadSubstitutionException(string msg, Exception innerException) : base(msg,innerException) { }
	}
}


text:
<?php
/*
 * id
 * createdBy
 * createdAt
 * updatedBy
 * updatedAt
 * updateReason
 * endTime (date/datetime?)
 * anyoneCanAddAnswers
 * question
 * multiselect
 * voters(?)
 * answers
 */


text:
@log.trace("Started executing 'fb-cloud:azure:operation:describe_instance_info.rb' flintbit...")
begin
    # Flintbit Input Parameters
    # Mandatory
    @connector_name = @input.get('connector_name')
    @action = 'describe-instance'
    @instance_name = @input.get('instance-name')
    @group_name = @input.get('group-name')

    # Optional
    @request_timeout = 120000
    @key = @input.get('key')
    @tenant_id = @input.get('tenant-id')
    @subscription_id = @input.get('subscription-id')
    @client_id = @input.get('client-id')

    @log.info("Flintbit input parameters are, action : #{@action} | Group name : #{@group_name} | Name : #{@instance_name}")

    connector_call = @call.connector(@connector_name)
                          .set('action', @action)
                          .set('tenant-id', @tenant_id)
                          .set('subscription-id', @subscription_id)
                          .set('key', @key)
                          .set('client-id', @client_id)
                          .set('instance-name',@instance_name)
                          .set('group-name',@group_name)

    if @connector_name.nil? || @connector_name.empty?
        raise 'Please provide "MS Azure connector name (connector_name)" to reboot Instance'
    end

    if @request_timeout.nil? || @request_timeout.is_a?(String)
        @log.trace("Calling #{@connector_name} with default timeout...")
        response = connector_call.sync
    else
        @log.trace("Calling #{@connector_name} with given timeout #{@request_timeout}...")
        response = connector_call.timeout(@request_timeout).sync
    end

    # Amazon EC2 Connector Response Meta Parameters
    response_exitcode = response.exitcode	# Exit status code
    response_message = response.message	# Execution status messages

    if response_exitcode == 0
        @log.info("SUCCESS in executing #{@connector_name} where, exitcode : #{response_exitcode} | message : #{response_message}")
        @output.set('exit-code', 0).set('message', response_message).set('instance-details',response.get('instance-details'))
    else
        @log.error("ERROR in executing #{@connector_name} where, exitcode : #{response_exitcode} | message : #{response_message}")
        @output.set('exit-code', 1).set('message', response_message)
    end
rescue Exception => e
    @log.error(e.message)
    @output.set('exit-code', 1).set('message', e.message)
end
@log.trace("Finished executing 'fb-cloud:azure:operation:describe_instance_info.rb' flintbit")
# end


text:
Profile

    Back

      Cart

    <search></search>

Edit Profile Information

              UserName

              {{user.username}}

      <form name="profileForm" data-ajax="false" ng-submit="submitUser()">

          First Name
          <input type="text" name="profileFirstName" id="profile-firstName" maxlength="45"
                 ng-model="user.firstName" ng-pattern="patternFirstName" ng-required="true">

            Wrong Format.

          Middle Name
          <input type="text" name="profileMiddleName" id="profile-middleName" maxlength="45"
                 ng-model="user.middleName" ng-pattern="patternMiddleName" ng-required="false">

            Wrong Format.

          Last Name
          <input type="text" name="profileLastName" id="profile-lastName" maxlength="45"
                 ng-model="user.lastName" ng-pattern="patternLastName" ng-required="true">

            Wrong Format.

          Email
          <input type="email" name="profileEmail" id="profile-email" maxlength="255"
                 ng-model="user.email" ng-required="true">

            Wrong Format.

          Telephone
          <input type="tel" name="profileTelephone" id="profile-telephone" maxlength="10"
                 ng-model="user.telephone" ng-pattern="patternTelephone" ng-required="true">

            Wrong Format.

          Question 1
          <select name="profileSecurityQuestion1" id="profile-securityQuestion-1"
                  ng-model="user.question1"
                  ng-options="question.id as question.question for question in questions"
                  ng-required="true">
          </select>
          Answer
          <input type="text" name="profileSecurityAnswer1" id="profile-securityAnswer-1" maxlength="45"
                 ng-model="user.questionAnswer1" ng-pattern="patternAnswer" ng-required="true">

            Wrong Format.

          Question 2
          <select name="profileSecurityQuestion2" id="profile-securityQuestion-2"
                  ng-model="user.question2"
                  ng-options="question.id as question.question for question in questions"
                  ng-required="true">
          </select>
          Answer
          <input type="text" name="profileSecurityAnswer2" id="profile-securityAnswer-2" maxlength="45"
                 ng-model="user.questionAnswer2" ng-pattern="patternAnswer" ng-required="true">

            Wrong Format.

          Question 3
          <select name="profileSecurityQuestion3" id="profile-securityQuestion-3"
                  ng-model="user.question3"
                  ng-options="question.id as question.question for question in questions"
                  ng-required="true">
          </select>
          Answer
          <input type="text" name="profileSecurityAnswer3" id="profile-securityAnswer-3" maxlength="45"
                 ng-model="user.questionAnswer3" ng-pattern="patternAnswer" ng-required="true">

            Wrong Format.

          Old Password
          <input type="password" name="profileOldPassword" id="profile-oldPassword"
                 autocomplete="off" maxlength="40"
                 ng-model="user.oldPassword" ng-pattern="patternPassword" ng-required="true">

            Wrong Format.

          New Password
          <input type="password" name="profileNewPassword" id="profile-newPassword"
                 autocomplete="off" maxlength="40"
                 ng-model="user.password" ng-pattern="patternPassword" ng-required="false">

            Wrong Format.

          Confirm Password
          <input type="password" name="profileNewPasswordConfirm" id="profile-newPasswordConfirm"
                 autocomplete="off" maxlength="40"
                 ng-model="user.passwordConfirm" ng-pattern="patternPassword" ng-required="false">

            Wrong Format.

          Cancel
          <button type="submit" data-icon="check" ng-class="{false: 'ui-disabled'}[profileForm.$valid]">Submit</button>

      </form>

Edit Mailing Addresses

                Mail Addresses on System

                    Add Mailing Address

                {{mailAddresses.length}}

                  Name:

                  {{mailAddress.recipientName}}

                  Address:

                  {{mailAddress.address}}

                  Country:

                  {{mailAddress.country}}

                  City:

                  {{mailAddress.city}}

                  State/Region/Prov.:

                  {{mailAddress.geoRegion}}

                  ZipCode:

                  {{mailAddress.zipCode}}

                  Telephone:

                  {{mailAddress.telephone}}

Edit Billing Addresses

                Bill Addresses on System

                    Add Billing Address

                {{billAddresses.length}}

                  Name:

                  {{billAddress.recipientName}}

                  Address:

                  {{billAddress.address}}

                  Country:

                  {{billAddress.country}}

                  City:

                  {{billAddress.city}}

                  State/Region/Prov.:

                  {{billAddress.geoRegion}}

                  ZipCode:

                  {{billAddress.zipCode}}

                  Telephone:

                  {{billAddress.telephone}}

My Ratings

              Your Average Rating

                User:

                {{rating.raterName}}

                Rating:

Choose An Action

      Edit
      Delete
      Cancel

Choose An Action

      Edit
      Delete
      Cancel

Address might be associated with one or more payment options.

          Please confirm if you wish to delete them as well along with the
          selected address.
Note: If address is associated with last remaining payment option,
          the address won't be deleted.

        Cancel
        Ok

    Close


text:
using System;

using Tabby.Station.ViewModels;
using Tabby.Station.Views;

namespace Tabby.Station.Controllers
{
    public class WindowController : IWindowController
    {
        public void OpenChatterWindow(Guid userId)
        {
            var chatter = new ChatterWindow();
            (chatter.DataContext as ChatterWindowViewModel).UserId = userId;
            chatter.Show();
        }
    }
}


text:
import { Component, Input, OnChanges, SimpleChanges } from '@angular/core';

import { heightCollapse } from '../../animations/height-collapse';

@Component({
  selector: 'help-window',
  templateUrl: './help-window.component.html',
  styleUrls: ['./help-window.component.scss'],
  animations: [heightCollapse]
})
export class HelpWindowComponent implements OnChanges {

  @Input() public helpHtml: string = '';
  public showHelp: boolean = false;

  constructor() { }

  ngOnChanges(changes: SimpleChanges) {
    if (changes.helpHtml) {
      this.helpHtml = this.helpHtml.trim().replace(/([^\n])\n([^\n])/g, '$1 $2');
    }
  }
}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:background="#EEE">

     <LinearLayout
        android:id="@+id/add_field_lay_row1"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:layout_alignParentLeft="true"
	    android:layout_alignParentTop="true"
	    android:weightSum="100">
        <Space
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="20" />
		<EditText
		        android:id="@+id/add_field_name"
		        android:layout_width="0dp"
		        android:layout_height="48dp"
		        android:hint="Field Name"
		        android:layout_weight="60"
		        />
		<Space
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="20" />
    </LinearLayout>

    <ImageButton
        android:id="@+id/add_field_done"
        android:layout_marginTop="16dp"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:contentDescription=""
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/add_field_lay_row1"
        android:background="@drawable/check_ok"
        />
    <ImageButton
        android:id="@+id/add_field_delete"
        android:layout_marginTop="16dp"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:contentDescription=""
        android:layout_alignParentRight="true"
        android:layout_below="@+id/add_field_lay_row1"
        android:background="@drawable/trash"
        />
    <ImageButton
        android:id="@+id/add_field_undo"
        android:layout_marginTop="16dp"
        android:layout_width="32dp"
        android:layout_height="32dp"
        android:contentDescription=""
        android:layout_marginRight="7dp"
        android:layout_toLeftOf="@+id/add_field_delete"
        android:layout_below="@+id/add_field_lay_row1"
        android:background="@drawable/delete_vertex"
        />

     <LinearLayout
        android:id="@+id/add_field_lay_row2"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_toRightOf="@+id/add_field_done"
	    android:layout_toLeftOf="@+id/add_field_undo"
	    android:layout_below="@+id/add_field_lay_row1"
	    android:gravity="center">

        <CheckBox
	        android:id="@+id/add_field_chkAutoAcres"
	        android:layout_width="wrap_content"
	        android:layout_height="48dp"
	        android:checked="true"
        />
		<EditText
	        android:id="@+id/add_field_etAcres"
	        android:layout_width="wrap_content"
	        android:layout_height="48dp"
	        android:hint="Acres"
	        android:text="59 ac"
	        android:inputType="numberDecimal"
	        android:digits="0123456789"
	        android:enabled="false"
        />

    </LinearLayout>

</RelativeLayout>


text:
#import <UIKit/UIView.h>

@interface UIView (Gestures_Internal)
- (float)_zoomAnimationProgress;
- (void)_animateZoomFailureToWindowPoint:(struct CGPoint)arg1 scale:(double)arg2 duration:(float)arg3;
- (void)_animateToScrollPoint:(struct CGPoint)arg1;
- (void)_zoomToWindowPoint:(struct CGPoint)arg1 scale:(double)arg2 duration:(float)arg3 constrainScrollPoint:(_Bool)arg4 event:(struct __GSEvent *)arg5;
- (float)_zoomAnimationDurationForScale:(double)arg1;
- (void)_zoomToScrollPoint:(struct CGPoint)arg1 scale:(double)arg2 duration:(float)arg3 event:(struct __GSEvent *)arg4;
- (struct CGPoint)_constrainedScrollPoint:(struct CGPoint)arg1 contentSize:(struct CGSize)arg2;
- (struct CGSize)_scrollerContentSize;
- (void)_gestureEnded:(struct __GSEvent *)arg1;
- (id)_gestureInfo;
@end


text:
from models import *
from views import *
from forms import *
from management import *


text:
import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }  from './app.component';
import { LittleTourComponent }  from './little-tour.component';

@NgModule({
  imports: [ BrowserModule ],
  declarations: [
    AppComponent,
    LittleTourComponent,
  ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }