region VALIDATE ********************************************************
514079
protected function validateJobParams(Job $job)
    {
        if (empty($job->getSender())) {
            throw new ResultException(ResultException::ERROR_PARAM_SENDER);
        }

        if (empty($job->getRecipient())) {
            throw new ResultException(ResultException::ERROR_PARAM_RECIPIENT);
        }

        if (empty($job->getText())) {
            throw new ResultException(ResultException::ERROR_PARAM_TEXT);
        }
    }
120856
public void endInvalidatingRegion() {
		synchronized (this) {
			if (--regionInvalidations == 0) {
				regionInvalidationTimestamp = timeSource.nextTimestamp();
				if (trace) {
					log.tracef("Finished invalidating region %s at %d", cache.getName(), regionInvalidationTimestamp);
				}
			}
			else {
				if (trace) {
					log.tracef("Finished invalidating region %s, but there are %d ongoing invalidations", cache.getName(), regionInvalidations);
				}
			}
		}
	}
913038
public boolean validateAllFields() {
        final boolean postalCodeValid;

        final String countrySelected = mCountryAutoCompleteTextView.getSelectedCountryCode();
        if (mPostalCodeEditText.getText().toString().isEmpty() &&
                (mOptionalShippingInfoFields.contains(POSTAL_CODE_FIELD) ||
                        mHiddenShippingInfoFields.contains(POSTAL_CODE_FIELD))) {
            postalCodeValid = true;
        } else if (countrySelected.equals(Locale.US.getCountry())) {
            postalCodeValid = CountryUtils.isUSZipCodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (countrySelected.equals(Locale.UK.getCountry())) {
            postalCodeValid = CountryUtils.isUKPostcodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (countrySelected.equals(Locale.CANADA.getCountry())) {
            postalCodeValid = CountryUtils.isCanadianPostalCodeValid(mPostalCodeEditText.getText()
                    .toString().trim());
        } else if (CountryUtils.doesCountryUsePostalCode(countrySelected)) {
            postalCodeValid = !mPostalCodeEditText.getText().toString().isEmpty();
        } else {
            postalCodeValid = true;
        }
        mPostalCodeEditText.setShouldShowError(!postalCodeValid);

        final boolean requiredAddressLine1Empty = mAddressEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(ADDRESS_LINE_ONE_FIELD) &&
                !mHiddenShippingInfoFields.contains(ADDRESS_LINE_ONE_FIELD);
        mAddressEditText.setShouldShowError(requiredAddressLine1Empty);

        final boolean requiredCityEmpty = mCityEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(CITY_FIELD) && !mHiddenShippingInfoFields
                .contains(CITY_FIELD);
        mCityEditText.setShouldShowError(requiredCityEmpty);

        final boolean requiredNameEmpty = mNameEditText.getText().toString().isEmpty();
        mNameEditText.setShouldShowError(requiredNameEmpty);

        final boolean requiredStateEmpty = mStateEditText.getText().toString().isEmpty() &&
                !mOptionalShippingInfoFields.contains(STATE_FIELD) && !mHiddenShippingInfoFields
                .contains(STATE_FIELD);
        mStateEditText.setShouldShowError(requiredStateEmpty);

        final boolean requiredPhoneNumberEmpty =
                mPhoneNumberEditText.getText().toString().isEmpty() &&
                        !mOptionalShippingInfoFields.contains(PHONE_FIELD) &&
                        !mHiddenShippingInfoFields.contains(PHONE_FIELD);
        mPhoneNumberEditText.setShouldShowError(requiredPhoneNumberEmpty);

        return postalCodeValid && !requiredAddressLine1Empty && !requiredCityEmpty &&
                !requiredStateEmpty && !requiredNameEmpty && !requiredPhoneNumberEmpty;
    }
599805
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    if (pvalue == null) {
      return true;
    }
    try {
      String countryCode =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCountryCode);
      final String postalCode =
          BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldPostalCode);
      if (StringUtils.isEmpty(postalCode)) {
        return true;
      }

      if (allowLowerCaseCountryCode) {
        countryCode = StringUtils.upperCase(countryCode);
      }

      final String regExCheck = POSTAL_CODE_MAP.postalCodes().get(countryCode);
      if (regExCheck == null) {
        return true;
      }
      if (postalCode.matches(regExCheck)) {
        return true;
      }
      switchContext(pcontext);
      return false;
    } catch (final Exception ignore) {
      switchContext(pcontext);
      return false;
    }
  }
275732
public function setRegion($region, $item)
    {
        if (is_array($item)) {
            $template = array_shift($item);
            $data = $item ? reset($item) : array();
            $content = $this->render($template, $data);
        } else {
            $content = trim($item);
        }

        if ($content !== '' && isset($this->templates["region_$region"])) {

            $weight = 1;

            if (isset($this->data["region_$region"])) {
                $weight = count($this->data["region_$region"]) + 1;
            }

            $this->data["region_$region"][] = array('rendered' => $content, 'weight' => $weight);
        }
    }
1315172
@Nonnull
    MapcodeZone restrictZoneTo(@Nonnull final Boundary area) {
        final MapcodeZone mapcodeZone = new MapcodeZone(latFractionMin, latFractionMax, lonFractionMin, lonFractionMax);
        final double latMin = area.getLatMicroDegMin() * Point.LAT_MICRODEG_TO_FRACTIONS_FACTOR;
        if (mapcodeZone.latFractionMin < latMin) {
            mapcodeZone.latFractionMin = latMin;
        }
        final double latMax = area.getLatMicroDegMax() * Point.LAT_MICRODEG_TO_FRACTIONS_FACTOR;
        if (mapcodeZone.latFractionMax > latMax) {
            mapcodeZone.latFractionMax = latMax;
        }
        if (mapcodeZone.latFractionMin < mapcodeZone.latFractionMax) {
            double lonMin = area.getLonMicroDegMin() * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR;
            double lonMax = area.getLonMicroDegMax() * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR;
            if ((lonMax < 0) && (mapcodeZone.lonFractionMin > 0)) {
                lonMin += (Point.MICRO_DEG_360 * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR);
                lonMax += (Point.MICRO_DEG_360 * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR);
            } else if ((lonMin > 1) && (mapcodeZone.lonFractionMax < 0)) {
                lonMin -= (Point.MICRO_DEG_360 * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR);
                lonMax -= (Point.MICRO_DEG_360 * Point.LON_MICRODEG_TO_FRACTIONS_FACTOR);
            }
            if (mapcodeZone.lonFractionMin < lonMin) {
                mapcodeZone.lonFractionMin = lonMin;
            }
            if (mapcodeZone.lonFractionMax > lonMax) {
                mapcodeZone.lonFractionMax = lonMax;
            }
        }
        return mapcodeZone;
    }
651504
def validate(self):
        
        if self.nregions is None:
            raise TypeError("neutral regions cannot be None")
        if self.sregions is None:
            raise TypeError("selected regions cannot be None")
        if self.recregions is None:
            raise TypeError("recombination regions cannot be None")
        if self.demography is None:
            raise TypeError("demography cannot be None")
        if self.prune_selected is None:
            raise TypeError("prune_selected cannot be None")
        if self.gvalue is None:
            raise TypeError("gvalue cannot be None")
        if self.rates is None:
            raise TypeError("rates cannot be None")
1301854
def do_region(self, x, y, w, h):
        """"""
        if (x is not None):
            raise IIIFError(code=501, parameter="region",
                            text="Null manipulator supports only region=/full/.")
1130616
protected function validateZoneCountryState()
    {
        $field = 'zone_id';
        $value = $this->getSubmitted($field);

        if (empty($value)) {
            return null;
        }

        $label = $this->translation->text('Zone');

        if (!is_numeric($value)) {
            $this->setErrorNumeric($field, $label);
            return false;
        }

        $zone = $this->zone->get($value);

        if (empty($zone)) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        return true;
    }
597695
protected function validateCountryCity()
    {
        $field = 'country';

        if ($this->isExcluded($field)) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Country');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $country = $this->country->get($value);

        if (empty($country['code'])) {
            $this->setErrorUnavailable($field, $label);
            return false;
        }

        $this->setSubmitted('country', $country['code']);
        return true;
    }
519009
function(){
    this.regionManager = new Marionette.RegionManager();

    this.listenTo(this.regionManager, "region:add", function(name, region){
      this[name] = region;
      this.trigger("region:add", name, region);
    });

    this.listenTo(this.regionManager, "region:remove", function(name, region){
      delete this[name];
      this.trigger("region:remove", name, region);
    });
  }
1087542
def constraint_equal?(region, constraint) 
      [region, constraint].collect{ |v| v.nil? || v == '' ? 'us-east-1' : v }.reduce(:==)
    end
1027521
@Override
  public boolean validateSegmentBoundary(Object o) throws IOException {
    if (o instanceof Long) {
      return validateWithSegmentBoundary((Long) o);
    } else {
      throw new IOException("incorrect type ");
    }
  }
1193134
public function validate() : void
    {
        if (null === $this->is_valid) {
            if (null === $this->user_value && null !== $this->default_value) {
                // There is a preset value, and its not being changed
                $this->is_valid = true;
            } elseif (true == $this->user_value || 1 == $this->user_value) {
                $this->user_value = 1;
                $this->is_valid = true;
            } elseif (false == $this->user_value || 0 == $this->user_value || '' == $this->user_value) {
                $this->user_value = 0;
                $this->is_valid = true;
            } elseif (false == $this->validator) {
                // This field does not get validated
                $this->is_valid = true;
            } else {
                $this->is_valid = false;
                $this->error = 'The provided value is not valid. Please enter a valid value.';
            }
        }

        // Check if the input is different from the default value
        if ($this->is_valid && null !== $this->user_value) {
            $this->is_changed = ($this->default_value != $this->user_value);
        }
    }
609846
protected function validateEditCountry()
    {
        $this->setSubmitted('country');
        $this->setSubmittedBool('status');
        $this->setSubmitted('update', $this->data_country);

        $this->validateComponent('country');

        return !$this->hasErrors();
    }
384042
@Override
    public void validate() {
        //validate the parameters
        String target = getTargetName();
        if (maxRetries() < -1) {

            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "retry.parameter.invalid.value.CWMFT5010E", "maxRetries", maxRetries(), target, "-1"));
        }
        if ((delay() < 0)) {

            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "retry.parameter.invalid.value.CWMFT5010E", "delay", delay(), target, "0"));
        }
        if ((jitter() < 0)) {

            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "retry.parameter.invalid.value.CWMFT5010E", "jitter", jitter(), target, "0"));
        }
        if (maxDuration() < 0) {

            throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "retry.parameter.invalid.value.CWMFT5010E", "maxDuration", maxDuration(), target, "0"));
        }
        if (maxDuration() != 0) {
            Duration maxDuration = Duration.of(maxDuration(), durationUnit());
            Duration delay = Duration.of(delay(), delayUnit());
            if (maxDuration.compareTo(delay) < 0) {
                throw new FaultToleranceDefinitionException(Tr.formatMessage(tc, "retry.parameter.invalid.value.CWMFT5017E", maxDuration(), durationUnit(), target,
                                                                             delay(),
                                                                             delayUnit()));

            }
        }
        if (tc.isWarningEnabled()) {
            if ((delay() != 0) && (jitter() != 0)) {
                Duration jitter = Duration.of(jitter(), jitterDelayUnit());
                Duration delay = Duration.of(delay(), delayUnit());
                if (jitter.compareTo(delay) >= 0) {
                    Tr.warning(tc, "retry.parameter.invalid.value.CWMFT5019W", jitter(), jitterDelayUnit(), target,
                               delay(),
                               delayUnit());

                }
            }
        }
    }
892551
function(region) {
            // Get form data.
            var serializeFormField = function(array) {
                var sarr = [];

                var i = 0;
                for (i=0; i<array.length;i++) {
                    var a = array[i];
                    var o = {};
                    o.name = a.name;
                    o.value = a.value;
                    o.type = a.type;
                    if (a.type === "checkbox") {
                        o.value = (a.checked) ? "on" : "off";
                    }
                    sarr.push(o);
                }
                return sarr;
            };

            var n = serializeFormField(document.querySelectorAll(region + " > input"));

            var data = (n).reduce(function(obj, field) {
                switch (field.type) {
                case 'number':
                    if (field.value !== "") {
                        obj[field.name] = parseFloat(field.value); // for fields that are numbers.
                    }
                    break;

                case 'checkbox':
                    obj[field.name] = (field.value === 'on') ? true : false; // for checkboxes.
                    break;

                default:
                    obj[field.name] = field.value; // default for fields that are text.
                    break;
                }

                return obj;
            }, {});

            return data;
        }