<commit_before>package com.ingensi.data.storeit;

import com.ingensi.data.storeit.entities.StoredEntity;

import java.util.Collection;
import java.util.stream.Stream;

/**
 * A common storage. A storage provides methods to access and store an entity type.
 *
 * @param <T> Type of stored entities.
 */
public interface Storage<T extends StoredEntity> {
    /**
     * Get all entities as list.
     *
     * @return A collection of entities.
     */
    Collection<T> list();

    /**
     * Get all entities as stream.
     *
     * @return A collection of entities.
     */
    Stream<T> stream();

    /**
     * Check whether an entity exists from its ID.
     *
     * @param id Id of the entity.
     * @return True if it exists, else false.
     * @throws StorageException In case of error.
     */
    boolean exists(String id) throws StorageException;

    /**
     * Store new entity. The given entity id will be used as ID in the storage.
     *
     * @param entity The entity to store.
     * @throws AlreadyExistsException If ID already exists in the storage.
     * @throws StorageException       When another error appends.
     */
    void store(T entity) throws StorageException;

    /**
     * Store new entity with custom id.
     *
     * @param entity The entity to store.
     * @param id     ID of the entity.
     * @throws AlreadyExistsException if ID already exists in the storage.
     * @throws StorageException       When another error appends.
     */
    void store(T entity, String id) throws StorageException;

    /**
     * Get an entity from its ID.
     *
     * @param id Id of the entity.
     * @return The retrieved entity.
     * @throws NotFoundException If entity is not found into storage.
     * @throws StorageException  When another error appends.<commit_msg>if to If<commit_after>package com.ingensi.data.storeit;

import com.ingensi.data.storeit.entities.StoredEntity;

import java.util.Collection;
import java.util.stream.Stream;

/**
 * A common storage. A storage provides methods to access and store an entity type.
 *
 * @param <T> Type of stored entities.
 */
public interface Storage<T extends StoredEntity> {
    /**
     * Get all entities as list.
     *
     * @return A collection of entities.
     */
    Collection<T> list();

    /**
     * Get all entities as stream.
     *
     * @return A collection of entities.
     */
    Stream<T> stream();

    /**
     * Check whether an entity exists from its ID.
     *
     * @param id Id of the entity.
     * @return True if it exists, else false.
     * @throws StorageException In case of error.
     */
    boolean exists(String id) throws StorageException;

    /**
     * Store new entity. The given entity id will be used as ID in the storage.
     *
     * @param entity The entity to store.
     * @throws AlreadyExistsException If ID already exists in the storage.
     * @throws StorageException       When another error appends.
     */
    void store(T entity) throws StorageException;

    /**
     * Store new entity with custom id.
     *
     * @param entity The entity to store.
     * @param id     ID of the entity.
     * @throws AlreadyExistsException If ID already exists in the storage.
     * @throws StorageException       When another error appends.
     */
    void store(T entity, String id) throws StorageException;

    /**
     * Get an entity from its ID.
     *
     * @param id Id of the entity.
     * @return The retrieved entity.
     * @throws NotFoundException If entity is not found into storage.
     * @throws StorageException  When another error appends.
{'fraction_non_alphanumeric': 0.08469415997785773, 'fraction_numerical': 0.0, 'mean_word_length': 2.3681267474370924, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2888300', 'n_tokens_mistral': 986, 'n_tokens_neox': 971, 'n_words': 403}