<commit_before>package se.simonsoft.cms.item.structure;

import java.util.LinkedList;
import java.util.List;

import se.simonsoft.cms.item.CmsItemPath;

/**
 * Understands the CMS configuration strings used to define sections of the
 * repository such as translations and releases, provides path transformations.
 * <p>
 * Sample config strings: <code>{@value #LANG_IN_ROOT}</code>, <code>{@value #LANG_IN_PROJ}</code>.  
 * <p>
 * This is a low level class designed to understands a specific CMS config syntax.
 * It is highly recommended for calling code to add an abstraction layer that
 * separates configuration and path transformation, for example a translation
 * service with area patterns injected that has getTranslationPath(master).
 * <p>
 * If using this API directly from business logic consider marking your code's intent
 * by instead calling {@link CmsTranslationsPattern} or {@link CmsReleasesPattern}.
 * <p>
 * An higher layer abstraction could use CmsItemId as input, to allow for example
 * revision numbers taken into account when transforming paths.
 */
public class CmsAreaPattern {

	/**
	 * Sample translation path setting {@value #LANG_IN_ROOT}.
	 */
	public static final CmsAreaPattern LANG_IN_ROOT = new CmsAreaPattern("/lang");
	/**
	 * Sample translation path setting {@value #LANG_IN_PROJ}.
	 */
	public static final CmsAreaPattern LANG_IN_PROJ = new CmsAreaPattern("/*/lang");
	
	private String value;
	private int index;
	private String name;
	
	public CmsAreaPattern(String configValue) throws IllegalArgumentException {
		this.value = configValue;
		read(value);
	}
	
	/**
	 * @return True if the path is inside the area and has a label.
	 */
	public boolean isPathInside(CmsItemPath path) {
		int ai = getAreaPathSegmentIndex();
		if (isAreaRelative()) {
			return -ai + 1 < path.getPathSegments().size()<commit_msg>More cleanup. @value inline tags didn't work anyway<commit_after>package se.simonsoft.cms.item.structure;

import java.util.LinkedList;
import java.util.List;

import se.simonsoft.cms.item.CmsItemPath;

/**
 * Understands the CMS configuration strings used to define sections of the
 * repository such as translations and releases, provides path transformations.
 * <p>
 * Sample config strings: <code>/lang</code>, <code>/*</code><code>/lang</code>, <code>lang</code>.  
 * <p>
 * This is a low level class designed to understands a specific CMS config syntax.
 * It is highly recommended for calling code to add an abstraction layer that
 * separates configuration and path transformation, for example a translation
 * service with area patterns injected that has getTranslationPath(master).
 * <p>
 * If using this API directly from business logic consider marking your code's intent
 * by instead calling {@link CmsTranslationsPattern} or {@link CmsReleasesPattern}.
 * <p>
 * An higher layer abstraction could use CmsItemId as input, to allow for example
 * revision numbers taken into account when transforming paths.
 */
public class CmsAreaPattern {
	
	private String value;
	private int index;
	private String name;
	
	public CmsAreaPattern(String configValue) throws IllegalArgumentException {
		this.value = configValue;
		read(value);
	}
	
	/**
	 * @return True if the path is inside the area and has a label.
	 */
	public boolean isPathInside(CmsItemPath path) {
		int ai = getAreaPathSegmentIndex();
		if (isAreaRelative()) {
			return -ai + 1 < path.getPathSegments().size()
{'fraction_non_alphanumeric': 0.08829509148997967, 'fraction_numerical': 0.0005808887598024978, 'mean_word_length': 4.52808988764045, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, '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': '15838', 'n_tokens_mistral': 982, 'n_tokens_neox': 916, 'n_words': 373}