<commit_before>package arez.component;

import arez.Arez;
import arez.ArezContext;
import arez.Component;
import arez.Disposable;
import arez.Observer;
import arez.annotations.ComponentNameRef;
import arez.annotations.ComponentRef;
import arez.annotations.ContextRef;
import java.util.function.Consumer;
import javax.annotation.Nonnull;

/**
 * Abstract base class for classes that are expected to clear references to components when the
 * component is disposed.
 */
abstract class AbstractEntryContainer<T>
{
  /**
   * Create an EntityReference for specified entity.
   * This class also sets up monitoring observer so that if the entity is disposed then the
   * onDisposeAction is invoked. The action is expected to detach the reference and may potentially
   * dispose the entity and/or remove the entry from a container.
   *
   * @param entity          the entity.
   * @param onDisposeAction the action to take when the entity is disposed.
   * @return the reference.
   */
  @Nonnull
  final EntityEntry<T> createEntityEntry( @Nonnull final T entity,
                                          @Nonnull final Consumer<EntityEntry<T>> onDisposeAction )
  {
    final EntityEntry<T> entry = new EntityEntry<>( entity );
    final String name =
      Arez.areNamesEnabled() ? getName() + ".EntityWatcher." + Identifiable.getArezId( entity ) : null;
    final Observer monitor =
      getContext().when( Arez.areNativeComponentsEnabled() ? component() : null,
                         name,
                         true,<commit_msg>Mark class as public so it's documentation appears in javadocs<commit_after>package arez.component;

import arez.Arez;
import arez.ArezContext;
import arez.Component;
import arez.Disposable;
import arez.Observer;
import arez.annotations.ComponentNameRef;
import arez.annotations.ComponentRef;
import arez.annotations.ContextRef;
import java.util.function.Consumer;
import javax.annotation.Nonnull;

/**
 * Abstract base class for classes that are expected to clear references to components when the
 * component is disposed.
 */
public abstract class AbstractEntryContainer<T>
{
  /**
   * Create an EntityReference for specified entity.
   * This class also sets up monitoring observer so that if the entity is disposed then the
   * onDisposeAction is invoked. The action is expected to detach the reference and may potentially
   * dispose the entity and/or remove the entry from a container.
   *
   * @param entity          the entity.
   * @param onDisposeAction the action to take when the entity is disposed.
   * @return the reference.
   */
  @Nonnull
  final EntityEntry<T> createEntityEntry( @Nonnull final T entity,
                                          @Nonnull final Consumer<EntityEntry<T>> onDisposeAction )
  {
    final EntityEntry<T> entry = new EntityEntry<>( entity );
    final String name =
      Arez.areNamesEnabled() ? getName() + ".EntityWatcher." + Identifiable.getArezId( entity ) : null;
    final Observer monitor =
      getContext().when( Arez.areNativeComponentsEnabled() ? component() : null,
                         name,
                         true,
{'fraction_non_alphanumeric': 0.07630906768837803, 'fraction_numerical': 0.0, 'mean_word_length': 3.1717709720372835, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7321119', 'n_tokens_mistral': 817, 'n_tokens_neox': 795, 'n_words': 295}