Picky setter for occurrence fields. Validates user input to be conform
the (Symyx) specification.
@param occurrence occurence value
356618
public void setOccurrence(String occurrence) throws CDKException {
        if (occurrence == null || occurrence.equals("")) {
            occurrence = ">0"; //revert to default
        } else {
            occurrence = occurrence.trim().replaceAll(" ", "");
            if (isValidOccurrenceSyntax(occurrence)) {
                this.occurrence = occurrence;
            } else
                throw new CDKException("Invalid occurence line: " + occurrence);
        }
    }
610346
public void setExceptionProblemSubscription(String value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setExceptionProblemSubscription", value);
        boolean wasEmpty = (getHdr2().getChoiceField(JsHdr2Access.EXCEPTION) == JsHdr2Access.IS_EXCEPTION_EMPTY);
        getHdr2().setField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMSUBSCRIPTION_DATA, value);
        if (wasEmpty)
        {
            // Need to mark the other optional exception field as empty
            getHdr2().setChoiceField(JsHdr2Access.EXCEPTION_DETAIL_PROBLEMDESTINATION, JsHdr2Access.IS_EXCEPTION_DETAIL_PROBLEMDESTINATION_EMPTY);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setExceptionProblemSubscription");
    }
675220
private void validateGeneratedValueAnnotation(final Class<?> clazz, Field field)
    {

        Table table = clazz.getAnnotation(Table.class);
        // Still we need to validate for this after post metadata
        // population.
        if (table != null)
        {
            String schemaName = table.schema();
            if (schemaName != null && schemaName.indexOf('@') > 0)
            {
                schemaName = schemaName.substring(0, schemaName.indexOf('@'));
                GeneratedValue generatedValue = field.getAnnotation(GeneratedValue.class);
                if (generatedValue != null && generatedValue.generator() != null
                        && !generatedValue.generator().isEmpty())
                {
                    if (!(field.isAnnotationPresent(TableGenerator.class)
                            || field.isAnnotationPresent(SequenceGenerator.class)
                            || clazz.isAnnotationPresent(TableGenerator.class) || clazz
                            .isAnnotationPresent(SequenceGenerator.class)))
                    {

                        throw new IllegalArgumentException("Unknown Id.generator: " + generatedValue.generator());
                    }
                    else
                    {
                        checkForGenerator(clazz, field, generatedValue, schemaName);
                    }
                }
            }
        }

    }
473753
private void replaceStringWithAliasName(StringOccurrence occurrence,
                                          String name,
                                          StringInfo info) {
    Node nameNode = IR.name(name);
    occurrence.parent.replaceChild(occurrence.node,
                                   nameNode);
    info.isAliased = true;
    compiler.reportChangeToEnclosingScope(nameNode);
  }
601997
private static int countWildcardsOccurrences(String templateMessage, String occurrence) {
        if (templateMessage != null && occurrence != null) {
            final Pattern pattern = Pattern.compile(occurrence);
            final Matcher matcher = pattern.matcher(templateMessage);
            int count = 0;
            while (matcher.find()) {
                count++;
            }
            return count;
        } else {
            return 0;
        }
    }
757279
def key_occurrence(self, key, update=True):
        
        if update:
            self.update()
        result = {}
        for k, v in self.database.items():
            if key in v:
                result[str(v[key])] = k
        return result
139751
public TextInputDialogBuilder setValidationPattern(final Pattern pattern, final String errorMessage) {
        return setValidator(new TextInputDialogResultValidator() {
            @Override
            public String validate(String content) {
                Matcher matcher = pattern.matcher(content);
                if(!matcher.matches()) {
                    if(errorMessage == null) {
                        return "Invalid input";
                    }
                    return errorMessage;
                }
                return null;
            }
        });
    }
693052
public static int occurrencesOf(String string, String singleCharacter)
    {
        if (singleCharacter.length() != 1)
        {
            throw new IllegalArgumentException("Argument should be a single character: " + singleCharacter);
        }
        return StringIterate.occurrencesOfChar(string, singleCharacter.charAt(0));
    }
1074292
private void checkForGenerator(final Class<?> clazz, Field field, GeneratedValue generatedValue, String schemaName)

    {

        TableGenerator tableGenerator = field.getAnnotation(TableGenerator.class);
        SequenceGenerator sequenceGenerator = field.getAnnotation(SequenceGenerator.class);
        if (tableGenerator == null || !tableGenerator.name().equals(generatedValue.generator()))
        {
            tableGenerator = clazz.getAnnotation(TableGenerator.class);
        }
        if (sequenceGenerator == null || !sequenceGenerator.name().equals(generatedValue.generator()))
        {
            sequenceGenerator = clazz.getAnnotation(SequenceGenerator.class);
        }

        if ((tableGenerator == null && sequenceGenerator == null)
                || (tableGenerator != null && !tableGenerator.name().equals(generatedValue.generator()))
                || (sequenceGenerator != null && !sequenceGenerator.name().equals(generatedValue.generator())))
        {

            throw new RuleValidationException("Unknown Id.generator: " + generatedValue.generator());

        }
        else if ((tableGenerator != null && !tableGenerator.schema().isEmpty() && !tableGenerator.schema().equals(
                schemaName))
                || (sequenceGenerator != null && !sequenceGenerator.schema().isEmpty() && !sequenceGenerator.schema()
                        .equals(schemaName)))
        {

            throw new RuleValidationException("Generator " + generatedValue.generator() + " in entity : "
                    + clazz.getName() + " has different schema name ,it should be same as entity have");

        }

    }
1099449
def _assert_occurrence(probe, target, amount=1):
    '''
    
    '''
    occ = len(probe)
    if occ > amount:
        msg = 'more than'
    elif occ < amount:
        msg = 'less than'
    elif not occ:
        msg = 'no'
    else:
        msg = None

    if msg:
        raise CommandExecutionError('Found {0} expected occurrences in "{1}" expression'.format(msg, target))

    return occ
336494
public void setExecutionException(final ExecutionException executionException) {
        // Only set the execution exception once
        if (executionException != null && thrownExecutionException.get() == null) {
            thrownExecutionException.compareAndSet(/* expectedValue = */ null, executionException);
        }
    }
260449
private void checkConformsToRegexes(String value) {
        //Not checking the datatype because the regex will always be null for non strings.
        this.sups().forEach(sup -> {
            String regex = sup.regex();
            if (regex != null && !Pattern.matches(regex, value)) {
                throw TransactionException.regexFailure(this, value, regex);
            }
        });
    }
323696
protected void validateGenerationType(GenerationType generationType) {
    if (generationType == null) {
      return;
    }
    if (generationType == GenerationType.IDENTITY) {
      if (!dialect.supportsIdentity()) {
        throw new GenException(Message.DOMAGEN0003, dialect.getName());
      }
    } else if (generationType == GenerationType.SEQUENCE) {
      if (!dialect.supportsSequence()) {
        throw new GenException(Message.DOMAGEN0004, dialect.getName());
      }
    }
  }
1170479
public static <T> Predicate<Multiset.Entry<T>> occursAtLeast(int n) {
    checkArgument(n >= 0);
    return new OccursAtLeast<>(n);
  }
999767
public void validateConstraints(Entity entity) {
		for (String propertyName : requiredProperties) {
            Object value = entity.getProperty(propertyName);
			if (value == null || (value instanceof String && ((String) value).length() == 0)) {
				throw new RequiredFieldException("Required property '" + this.persistentClass.getSimpleName() + "." + propertyName + "' is not set");
			}
		}
	}
541200
@Check(CheckType.FAST)
	public void checkFieldName(SarlField field) {
		final JvmField inferredType = this.associations.getJvmField(field);
		final QualifiedName name = Utils.getQualifiedName(inferredType);
		if (this.featureNames.isDisallowedName(name)) {
			final String validName = Utils.fixHiddenMember(field.getName());
			error(MessageFormat.format(
					Messages.SARLValidator_41,
					field.getName()),
					field,
					XTEND_FIELD__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					VARIABLE_NAME_DISALLOWED,
					validName);
		} else if (this.grammarAccess.getOccurrenceKeyword().equals(field.getName())) {
			error(MessageFormat.format(
					Messages.SARLValidator_41,
					this.grammarAccess.getOccurrenceKeyword()),
					field,
					XTEND_FIELD__NAME,
					ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
					VARIABLE_NAME_DISALLOWED);
		}
	}
1281423
public void setPattern(String patternType) {

        final PatternType type = PatternType.valueOf(patternType);
        if (type != m_model.getPatternType()) {
            removeExceptionsOnChange(new Command() {

                public void execute() {

                    EndType oldEndType = m_model.getEndType();
                    m_model.setPatternType(type);
                    m_model.setIndividualDates(null);
                    m_model.setInterval(getPatternDefaultValues().getInterval());
                    m_model.setEveryWorkingDay(Boolean.FALSE);
                    m_model.clearWeekDays();
                    m_model.clearIndividualDates();
                    m_model.clearWeeksOfMonth();
                    m_model.clearExceptions();
                    if (type.equals(PatternType.NONE) || type.equals(PatternType.INDIVIDUAL)) {
                        m_model.setEndType(EndType.SINGLE);
                    } else if (oldEndType.equals(EndType.SINGLE)) {
                        m_model.setEndType(EndType.TIMES);
                        m_model.setOccurrences(10);
                        m_model.setSeriesEndDate(null);
                    }
                    m_model.setDayOfMonth(getPatternDefaultValues().getDayOfMonth());
                    m_model.setMonth(getPatternDefaultValues().getMonth());
                    if (type.equals(PatternType.WEEKLY)) {
                        m_model.setWeekDay(getPatternDefaultValues().getWeekDay());
                    }
                    valueChanged();
                }
            });
        }

    }