<commit_before>package net.oneandone.concierge.resource.helper;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import net.oneandone.concierge.api.Element;
import net.oneandone.concierge.api.filter.AddressFilter;
import net.oneandone.concierge.api.filter.Filters;
import net.oneandone.concierge.api.filter.PageFilter;

import java.util.Arrays;
import java.util.Collection;
import java.util.OptionalInt;

public class ResourceIdentifier {

    /**
     * Parses the specified URI and returns the resource identifier.
     *
     * @param uri the URI to parse
     * @return the resource identifier for the specified URI
     */
    public static ResourceIdentifier parse(final String uri) {
        return new ResourceIdentifier(uri, ImmutableMultimap.of());
    }

    /**
     * Parses the specified URI and returns the resource identifier.
     *
     * @param uri        the URI to parse
     * @param parameters the request parameters
     * @return the resource identifier for the specified URI
     */
    public static ResourceIdentifier parse(final String uri, final Multimap<String, String> parameters) {
        return new ResourceIdentifier(uri, parameters);
    }
<commit_msg>more javadoc<commit_after>package net.oneandone.concierge.resource.helper;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import net.oneandone.concierge.api.Element;
import net.oneandone.concierge.api.filter.AddressFilter;
import net.oneandone.concierge.api.filter.Filters;
import net.oneandone.concierge.api.filter.PageFilter;

import java.util.Arrays;
import java.util.Collection;
import java.util.OptionalInt;

/**
 * This class implements our resource identifier pattern.
 * <p/>
 * We have three types of resources:
 * <ol>
 * <li>{@link Element elements} are uniquely addressable resources</li>
 * <li>{@link net.oneandone.concierge.api.Group groups} may contain multiple elements</li>
 * <li>{@link net.oneandone.concierge.api.Extension extensions} may provided additional information for elements</li>
 * </ol>
 * Elements may also contain further groups, which leads us to a pattern how to address resources.
 * <ul>
 * <li>A resource identifier always starts with a group and may end anytime</li>
 * <li>If something follows on a group it's always an element</li>
 * <li>The next identifier to an element might be the name of a group or extension</li>
 * <li>An extension must terminate the resource identifier</li>
 * </ul>
 * So a resource identifier might look like {@code group1/id1/group2/id2/extension}.
 * <p/>
 * The scope of a resource identifier is a pair of group and an optional element identifier or the address of an extension.
 * In the example above we see three scopes:
 * <ol>
 * <li>{@code group1/id1}</li>
 * <li>{@code group2/id2}</li>
 * <li>and {@code extension}</li>
 * </ol>
 * The resource identifier will be initialized with scope 1) and will return the scope on call of this method.
 */
public class ResourceIdentifier {

    /**
     * Parses the specified URI and returns the resource identifier.
     *
     * @param uri the URI to parse
     * @return the resource identifier for the specified URI
     */
    public static ResourceIdentifier parse(final String uri) {
        return new ResourceIdentifier(uri, ImmutableMultimap.of());
    }

    /**
     * Parses the specified URI and returns the resource identifier.
     *
     * @param uri        the URI to parse
     * @param parameters the request parameters
     * @return the resource identifier for the specified URI
     */
    public static ResourceIdentifier parse(final String uri, final Multimap<String, String> parameters) {
        return new ResourceIdentifier(uri, parameters);
    }

{'fraction_non_alphanumeric': 0.09194214876033058, 'fraction_numerical': 0.0023243801652892563, 'mean_word_length': 3.805210918114144, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, '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': '1568388', 'n_tokens_mistral': 1062, 'n_tokens_neox': 1059, 'n_words': 370}