<commit_before>package org.realityforge.replicant.client.aoi;

import arez.Arez;
import arez.annotations.ArezComponent;
import arez.annotations.ComponentId;
import arez.annotations.Observable;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.replicant.client.Channel;
import org.realityforge.replicant.client.ChannelAddress;
import org.realityforge.replicant.client.subscription.Subscription;

/**
 * The channel description declares a desired channel subscription and also
 * includes data on the current status of the subscription.
 */
@ArezComponent
public abstract class AreaOfInterest
{
  public enum Status
  {
    NOT_ASKED,
    LOADING,
    LOADED,
    LOAD_FAILED,
    UPDATING,
    UPDATED,
    UPDATE_FAILED,
    UNLOADING,
    UNLOADED
  }

  @Nonnull
  private final Channel _channel;
  @Nonnull
  private Status _status = Status.NOT_ASKED;
  @Nullable
  private Subscription _entry;
  @Nullable
  private Throwable _error;

  @Nonnull
  public static AreaOfInterest create( @Nonnull final Channel channel )
  {
    return new Arez_AreaOfInterest( channel );
  }

  AreaOfInterest( @Nonnull final Channel channel )
  {
    _channel = Objects.requireNonNull( channel );
  }

  @ComponentId
  @Nonnull
  public final ChannelAddress getAddress()
  {
    return getChannel().getAddress();
  }

  @Nonnull
  public Channel getChannel()
  {
    return _channel;
  }

  @Observable
  @Nonnull
  public Status getStatus()
  {
    return _status;
  }

  public void setStatus( @Nonnull final Status status )
  {
    _status = Objects.requireNonNull( status );
  }

  @Observable
  @Nullable
  public Throwable getError()
  {
    return _error;
  }

  public void setError( @Nullable final Throwable error )
  {
    _error = error;
  }

  @Observable
  @Nullable
  public Subscription getEntry()
  {
    return _entry;
  }

  public void setEntry( @Nullable final Subscription entry )
  {
    _entry = entry;
  }

  @Override
  public String toString()
  {
    if ( Arez.areNamesEnabled() )
    {
      return "AreaOfInterest[" + _channel + " Status: " + _status + "]";
    }
    else
    {
      return super.toString();
    }
  }
}
<commit_msg>Simplify code<commit_after>package org.realityforge.replicant.client.aoi;

import arez.Arez;
import arez.annotations.ArezComponent;
import arez.annotations.ComponentId;
import arez.annotations.Observable;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.realityforge.replicant.client.Channel;
import org.realityforge.replicant.client.ChannelAddress;
import org.realityforge.replicant.client.subscription.Subscription;

/**
 * The channel description declares a desired channel subscription and also
 * includes data on the current status of the subscription.
 */
@ArezComponent
public abstract class AreaOfInterest
{
  public enum Status
  {
    NOT_ASKED,
    LOADING,
    LOADED,
    LOAD_FAILED,
    UPDATING,
    UPDATED,
    UPDATE_FAILED,
    UNLOADING,
    UNLOADED
  }

  @Nonnull
  private final Channel _channel;
  @Nonnull
  private Status _status = Status.NOT_ASKED;

  @Nonnull
  public static AreaOfInterest create( @Nonnull final Channel channel )
  {
    return new Arez_AreaOfInterest( channel );
  }

  AreaOfInterest( @Nonnull final Channel channel )
  {
    _channel = Objects.requireNonNull( channel );
  }

  @ComponentId
  @Nonnull
  public final ChannelAddress getAddress()
  {
    return getChannel().getAddress();
  }

  @Nonnull
  public final Channel getChannel()
  {
    return _channel;
  }

  @Observable
  @Nonnull
  public Status getStatus()
  {
    return _status;
  }

  public void setStatus( @Nonnull final Status status )
  {
    _status = Objects.requireNonNull( status );
  }

  @Observable
  @Nullable
  public abstract Throwable getError();

  public abstract void setError( @Nullable Throwable error );

  @Observable
  @Nullable
  public abstract Subscription getEntry();

  public abstract void setEntry( @Nullable Subscription entry );

  @Override
  public String toString()
  {
    if ( Arez.areNamesEnabled() )
    {
      return "AreaOfInterest[" + _channel + " Status: " + _status + "]";
    }
    else
    {
      return super.toString();
    }
  }
}

{'fraction_non_alphanumeric': 0.08514619883040936, 'fraction_numerical': 0.0, 'mean_word_length': 3.4774869109947644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3527240', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1304, 'n_words': 336}