Checks whether the registry number is valid.

@param casNumber  the CAS number to validate
@cdk.keyword CAS number
@cdk.keyword validation
@return true if a valid CAS number, false otherwise
181251
public static boolean isValid(String casNumber) {
        boolean overall = true;
        /*
         * check format
         */
        String format = "^(\\d+)-(\\d\\d)-(\\d)$";
        Pattern pattern = Pattern.compile(format);
        Matcher matcher = pattern.matcher(casNumber);
        overall = overall && matcher.matches();

        if (matcher.matches()) {
            /*
             * check number
             */
            String part1 = matcher.group(1);
            String part2 = matcher.group(2);
            String part3 = matcher.group(3);
            int part1value = Integer.parseInt(part1);
            if (part1value < 50) {
                overall = false;
                // CAS numbers start at 50-00-0
            } else {
                int digit = CASNumber.calculateCheckDigit(part1, part2);
                overall = overall && (digit == Integer.parseInt(part3));
            }
        }

        return overall;
    }
72932
public static final boolean verifyFormat(String idNumber) {
        if (StringUtils.isBlank(idNumber)) {
            return false;
        }
        idNumber = idNumber.trim();
        if (!checkIdNumberRegex(idNumber)) {
            return false;
        }
        if (!checkIdNumberArea(idNumber.substring(0, 6))) {
            return false;
        }
        idNumber = convertFifteenToEighteen(idNumber);
        if (!checkBirthday(idNumber.substring(6, 14))) {
            return false;
        }
        if (!checkIdNumberVerifyCode(idNumber)) {
            return false;
        }
        return true;
    }
582457
private boolean checkEeTaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(10) - '0';
    int calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 1 //
        + (ptaxNumber.charAt(1) - '0') * 2 //
        + (ptaxNumber.charAt(2) - '0') * 3 //
        + (ptaxNumber.charAt(3) - '0') * 4 //
        + (ptaxNumber.charAt(4) - '0') * 5 //
        + (ptaxNumber.charAt(5) - '0') * 6 //
        + (ptaxNumber.charAt(6) - '0') * 7 //
        + (ptaxNumber.charAt(7) - '0') * 8 //
        + (ptaxNumber.charAt(8) - '0') * 9 //
        + (ptaxNumber.charAt(9) - '0') * 1) //
        % MODULO_11;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = ((ptaxNumber.charAt(0) - '0') * 3 //
          + (ptaxNumber.charAt(1) - '0') * 4 //
          + (ptaxNumber.charAt(2) - '0') * 5 //
          + (ptaxNumber.charAt(3) - '0') * 6 //
          + (ptaxNumber.charAt(4) - '0') * 7 //
          + (ptaxNumber.charAt(5) - '0') * 8 //
          + (ptaxNumber.charAt(6) - '0') * 9 //
          + (ptaxNumber.charAt(7) - '0') * 1 //
          + (ptaxNumber.charAt(8) - '0') * 2 //
          + (ptaxNumber.charAt(9) - '0') * 3) //
          % MODULO_11 % 10;
    }
    return checkSum == calculatedCheckSum;
  }
546206
@SuppressWarnings ("deprecation")
  public static void initStandard (@Nonnull final ValidationExecutorSetRegistry aRegistry)
  {
    // For better error messages
    LocationBeautifierSPI.addMappings (UBL21NamespaceContext.getInstance ());

    PeppolValidation350.init (aRegistry);
    PeppolValidation360.init (aRegistry);
    PeppolValidation370.init (aRegistry);
  }
343199
public static List<AnnotationValidator> getAnnotationValidator(Registry registry, Object object) {
        if (registry == null || object == null) {
            return Collections.emptyList();
        }
        Class clazz = object.getClass();
        if (!CLASS_2_ANNOTATION_VALIDATOR_MAP.containsKey(clazz)) {
            addByClass(registry, object.getClass());
        }
        return CLASS_2_ANNOTATION_VALIDATOR_MAP.get(clazz);
    }
1326957
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);
    if (StringUtils.isEmpty(valueAsString)) {
      return true;
    }
    if (!StringUtils.isNumeric(valueAsString)) {
      // EAN must be numeric, but that's handled by digits annotation
      return true;
    }
    if (valueAsString.length() != Gtin8Validator.GTIN8_LENGTH
        && valueAsString.length() != Gtin13Validator.GTIN13_LENGTH) {
      // EAN size is wrong, but that's handled by alternate size annotation
      return true;
    }
    // calculate and check checksum (GTIN/EAN)
    return CHECK_GTIN.isValid(valueAsString);
  }
15238
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);
    if (StringUtils.isEmpty(valueAsString)) {
      return true;
    }
    if (valueAsString.length() != ISBN10_LENGTH) {
      // ISBN10 size is wrong, but that's handled by size annotation
      return true;
    }
    // calculate and check checksum (ISBN10)
    return CHECK_ISBN.isValidISBN10(valueAsString);
  }
482430
public static CipherExecutor newTicketRegistryCipherExecutor(final EncryptionRandomizedSigningJwtCryptographyProperties registry,
                                                                 final String registryName) {
        return newTicketRegistryCipherExecutor(registry, false, registryName);
    }
371875
public static boolean isValid(String fodselsnummer) {
		try {
			FodselsnummerValidator.getFodselsnummer(fodselsnummer);
			return true;
		} catch (IllegalArgumentException e) {
			return false;
		}
	}
876113
@SuppressWarnings("unused")
    public boolean isValid() {
        Phonenumber.PhoneNumber phoneNumber = getPhoneNumber();
        return phoneNumber != null && mPhoneUtil.isValidNumber(phoneNumber);
    }
463450
public static boolean isNumberic(Object obj) {
        if (obj == null) {
            Log.e("isNumeric", "parameter can't be null.");
            return false;
        }

        try {
            Double.parseDouble(obj.toString());
        } catch (Exception e) {
            return false;
        }

        return true;
    }
238659
public boolean isValid() {
        int totalNumberOfColumns = 0;
        Set<Object> columns = new HashSet<>();
        for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
            AssociativeArray row = entry.getValue();
            if(columns.isEmpty()) {
                //this is executed only for the first row
                for(Object column : row.internalData.keySet()) {
                    columns.add(column);
                }
                totalNumberOfColumns = columns.size();
            }
            else {
                //validating the columns of next rows based on first column
                if(totalNumberOfColumns!=row.size()) {
                    return false; //if the number of rows do not much then it is invalid
                }
                
                for(Object column : columns) {
                    if(row.containsKey(column)==false) {
                        return false; //if one of the detected columns do not exist, it is invalid
                    }
                }
            }
        }
        return true;
    }
1290516
private boolean checkModulo11TaxNumber(final String ptaxNumber) {
    final int checkSum = ptaxNumber.charAt(ptaxNumber.length() - 1) - '0';
    int sum = 10;
    for (int i = 0; i < ptaxNumber.length() - 1; i++) {
      int summe = (ptaxNumber.charAt(i) - '0' + sum) % 10;
      if (summe == 0) {
        summe = 10;
      }
      sum = 2 * summe % MODULO_11;
    }
    int calculatedCheckSum = MODULO_11 - sum;
    if (calculatedCheckSum == 10) {
      calculatedCheckSum = 0;
    }
    return checkSum == calculatedCheckSum;
  }
914766
def _verify(leniency, numobj, candidate, matcher):
    """"""
    if leniency == Leniency.POSSIBLE:
        return is_possible_number(numobj)
    elif leniency == Leniency.VALID:
        if (not is_valid_number(numobj) or
            not _contains_only_valid_x_chars(numobj, candidate)):
            return False
        return _is_national_prefix_present_if_required(numobj)
    elif leniency == Leniency.STRICT_GROUPING:
        return _verify_strict_grouping(numobj, candidate, matcher)
    elif leniency == Leniency.EXACT_GROUPING:
        return _verify_exact_grouping(numobj, candidate, matcher)
    else:
        raise Exception("Error: unsupported Leniency value %s" % leniency)
74428
public static boolean isValidRgroupQueryLabel(String Rxx) {
        Matcher matcher = validLabelPattern.matcher(Rxx);
        if (matcher.find()) {
            int groupNumber = Integer.valueOf(Rxx.substring(1));
            if (groupNumber >= 1 && groupNumber <= 32) {
                return true;
            }
        }
        return false;
    }
1012691
public function isValidVATNumber($vatNumber)
    {
        $details = self::getVATDetails($vatNumber);

        if ($details) {
            return $details->valid;
        } else {
            return false;
        }
    }
864107
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);
    if (StringUtils.isEmpty(valueAsString)) {
      return true;
    }
    if (!StringUtils.isNumeric(valueAsString)) {
      // EAN8 must be numeric, but that's handled by digits annotation
      return true;
    }
    if (valueAsString.length() != GTIN8_LENGTH) {
      // EAN8 size is wrong, but that's handled by size annotation
      return true;
    }
    // calculate and check checksum (GTIN8/EAN8)
    return CHECK_GTIN8.isValid(valueAsString);
  }