<commit_before>package org.pathwayeditor.businessobjects.notationsubsystem;


/**
 * Encapsulates a validation rule.
 * @author <NAME>
 *
 */
public interface IValidationRuleDefinition {
	 /** <em>Mandatory</em> means the rule must be satisfied and it will always generate validation errors on failure.<p>
	 *  <em>Optional</em> is a rule can be ignored, set to a warning or raised as an error.
	 */
	public enum RuleLevel {
          OPTIONAL, MANDATORY
	}
	public enum RuleEnforcement {
		ERROR, WARNING, IGNORE
	}

	INotationValidationService getValidationService();
	/**
	 * 
	 * @return A unique numerical identifier for this validation rule
	 */
	int getRuleNumber();
	
	/**
	 * A user-readable name of the rule.
	 * @return a <code>String</code>, not null
	 */
	String getName();
	
	/**
	 * Returns a short  String describing the intent of the validation rule
	 * for display in the UI
	 * @return A <code>String</code>, not null
	 */
	String getDescription();
	
	/**
	 * Returns a full description of the logic and meaning of the validation rule
	 * for display in user help documentation.
	 * @return A <code>String</code>, not null
	 */
	String getDetailedDescription();
	
	/**
	 * Returns a string representing the category of the rule. The category is defined by the rule and does
	 * not comply with a controlled vocabulary. It is essentially a way of categorising the type of rule, such as
	 * "Syntactic", "Semantic" etc.   
	 * @return A <code>String</code>.
	 */
	String getRuleCategory();

	
	/**
	 * Tests if the given ruleEnforcement is valid and appropriate for the current
	 * rule level. Ensures MANDATORY rules can only be set as an ERROR. 
	 * @param ruleEnforcement the enforcement to be tested.
	 * @return true if the the rule enforcement is valid, false otherwise.
	 */
	boolean isValidEnforcement(RuleEnforcement ruleEnforecement);
	
	/**
	 * Gets the default enforcement level for this rule.
	 * @return the default enforcement level, which must comply with the
	 *  postcondition: <code>isValidEnforcement(getDefaultEnforcementLevel())</code>.
	 */
	RuleEnforcement getDefaultEnforcementLevel(); 
	
	/**
	 * Gets the level of this rule. 
	 * 
	 * @return A {@link RuleLevel} enum.
	 */
    RuleLevel getRuleLevel();

}
<commit_msg>Updated documentation about how a rule is defined.<commit_after>package org.pathwayeditor.businessobjects.notationsubsystem;


/**
 * <p>Defines a validation rule. A validation rule can have a &quot;Level&quot; of either mandatory or optional. A validation
 * rule has an &quot;Enforcement&quot; which defines the consequence of the rule being invalid.</p>
 * 
 * <p>If a rule is MANDATORY then it must always be validated and if the rule is invalid then this should be enforced as an error.
 *  A rule level of MANDATORY must always have an enforcement level of ERROR.</p>
 * 
 * <p>If a rule is OPTIONAL then it will be validated <b>unless</b> enforcement is set to IGNORE. If the rule is invalid
 * then this will be enforced as an error or warning depending on the <code>RuleEnforecement</code> setting. The default enforcement
 * is set in the definition, but the application may choose to change this via <code>IValidationRuleConfig</code>.
 */
public interface IValidationRuleDefinition {
	 /** <em>Mandatory</em> means the rule must be satisfied and it will always generate validation errors on failure.<p>
	 *  <em>Optional</em> is a rule can be ignored, set to a warning or raised as an error.
	 */
	public enum RuleLevel {
          OPTIONAL, MANDATORY
	}
	public enum RuleEnforcement {
		ERROR, WARNING, IGNORE
	}

	INotationValidationService getValidationService();
	/**
	 * 
	 * @return A unique numerical identifier for this validation rule
	 */
	int getRuleNumber();
	
	/**
	 * A user-readable name of the rule.
	 * @return a <code>String</code>, not null
	 */
	String getName();
	
	/**
	 * Returns a short  String describing the intent of the validation rule
	 * for display in the UI
	 * @return A <code>String</code>, not null
	 */
	String getDescription();
	
	/**
	 * Returns a full description of the logic and meaning of the validation rule
	 * for display in user help documentation.
	 * @return A <code>String</code>, not null
	 */
	String getDetailedDescription();
	
	/**
	 * Returns a string representing the category of the rule. The category is defined by the rule and does
	 * not comply with a controlled vocabulary. It is essentially a way of categorising the type of rule, such as
	 * "Syntactic", "Semantic" etc.   
	 * @return A <code>String</code>.
	 */
	String getRuleCategory();

	
	/**
	 * Tests if the given ruleEnforcement is valid and appropriate for the current
	 * rule level. Ensures MANDATORY rules can only be set as an ERROR. 
	 * @param ruleEnforcement the enforcement to be tested.
	 * @return true if the the rule enforcement is valid, false otherwise.
	 */
	boolean isValidEnforcement(RuleEnforcement ruleEnforecement);
	
	/**
	 * Gets the default enforcement level for this rule.
	 * @return the default enforcement level, which must comply with the
	 *  postcondition: <code>isValidEnforcement(getDefaultEnforcementLevel())</code>.
	 */
	RuleEnforcement getDefaultEnforcementLevel(); 
	
	/**
	 * Gets the level of this rule. 
	 * 
	 * @return A {@link RuleLevel} enum.
	 */
    RuleLevel getRuleLevel();

}

{'fraction_non_alphanumeric': 0.08441203281677302, 'fraction_numerical': 0.0, 'mean_word_length': 3.197398622800306, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6651794', 'n_tokens_mistral': 1602, 'n_tokens_neox': 1422, 'n_words': 632}